Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/107-documentation-for-providers
Browse files Browse the repository at this point in the history
  • Loading branch information
fgbulsoni committed Feb 17, 2017
2 parents 0d50eb4 + 2c640d7 commit d8532c6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/unit/provider/oneview_server_profile_c7000_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
data:
{
'name' => 'Profile',
'description' => 'description',
'serverHardwareUri' => '/rest/server-hardware/37333036-3831-584D-5131-303030323037'
},
provider: 'c7000'
Expand Down Expand Up @@ -70,6 +71,26 @@
expect(provider.create).to be
end

it 'should create when resource does not exist' do
allow(resourcetype).to receive(:find_by).and_return([])
expect(provider.exists?).to eq(false)
expect_any_instance_of(resourcetype).to receive(:create).and_return(test)
expect(provider.create).to be
end

it 'should not create when resource is compliant' do
expect(provider.exists?).to eq(true)
expect(resourcetype).not_to receive(:create)
expect(provider.create).to be
end

it 'should update when resource is not compliant' do
test['description'] = 'new description'
expect_any_instance_of(resourcetype).to receive(:update)
expect_any_instance_of(resourcetype).not_to receive(:create)
expect(provider.create).to be
end

it 'should be able to perform the patch update' do
allow_any_instance_of(resourcetype).to receive(:update_from_template).and_return(FakeResponse.new('uri' => '/rest/fake'))
expect(provider.update_from_template).to be
Expand Down
21 changes: 21 additions & 0 deletions spec/unit/provider/oneview_server_profile_synergy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
data:
{
'name' => 'Profile',
'description' => 'description',
'serverHardwareUri' => '/rest/server-hardware/37333036-3831-584D-5131-303030323037'
},
provider: 'synergy'
Expand Down Expand Up @@ -67,6 +68,26 @@
expect(provider.create).to be
end

it 'should create when resource does not exist' do
allow(resourcetype).to receive(:find_by).and_return([])
expect(provider.exists?).to eq(false)
expect_any_instance_of(resourcetype).to receive(:create).and_return(test)
expect(provider.create).to be
end

it 'should not create when resource is compliant' do
expect(provider.exists?).to eq(true)
expect(resourcetype).not_to receive(:create)
expect(provider.create).to be
end

it 'should update when resource is not compliant' do
test['description'] = 'new description'
expect_any_instance_of(resourcetype).to receive(:update)
expect_any_instance_of(resourcetype).not_to receive(:create)
expect(provider.create).to be
end

it 'should be able to perform the patch update' do
allow_any_instance_of(resourcetype).to receive(:update_from_template).and_return(FakeResponse.new('uri' => '/rest/fake'))
expect(provider.update_from_template).to be
Expand Down

0 comments on commit d8532c6

Please sign in to comment.