-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15552 from alexander-demichev/flavors
Flavors create and add methods
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
describe Flavor do | ||
let(:ems) { FactoryGirl.create(:ems_openstack) } | ||
|
||
context 'when calling raw_create_flavor methods' do | ||
it 'raises NotImplementedError' do | ||
expect do | ||
subject.class.raw_create_flavor(1, {}) | ||
end.to raise_error(NotImplementedError, "raw_create_flavor must be implemented in a subclass") | ||
end | ||
end | ||
|
||
context 'when calling raw_create_flavor methods' do | ||
it 'raises NotImplementedError' do | ||
expect do | ||
subject.raw_delete_flavor | ||
end.to raise_error(NotImplementedError, "raw_delete_flavor must be implemented in a subclass") | ||
end | ||
end | ||
|
||
context 'when calling create_flavor method' do | ||
it 'should call raw_create_flavor' do | ||
flavor_double = class_double('ManageIQ::Providers::Openstack::CloudManager::Flavor') | ||
allow(subject.class).to receive(:class_by_ems).and_return(flavor_double) | ||
expect(flavor_double).to receive(:raw_create_flavor) | ||
subject.class.create_flavor(ems.id, {}) | ||
end | ||
end | ||
|
||
context 'when calling delete_flavor method' do | ||
it 'should call raw_delete_flavor' do | ||
expect(subject).to receive(:raw_delete_flavor) | ||
subject.delete_flavor | ||
end | ||
end | ||
end |