Skip to content

Commit

Permalink
Fixes based on PR comments
Browse files Browse the repository at this point in the history
- Changed suggested release to 4.1.1
- Fixed typing errors
- Made adjustments to the tests
  • Loading branch information
ricardogpsf committed Mar 23, 2017
1 parent 4b05be0 commit a4b56f2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Unreleased Changes
## Suggested release: v5.0.0
## Suggested release: v4.1.1

#### New Resources:
(none)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.get_default_settings(client)
# Adds an interconnect
# @param [Fixnum] bay Bay number
# @param [String] type Interconnect type
# @raise [StandardError] if a invalid type is given then raises an error
# @raise [StandardError] if an invalid type is given
def add_interconnect(bay, type)
interconnect_type = OneviewSDK::Interconnect.get_type(@client, type)
raise OneviewSDK::NotFound unless interconnect_type
Expand Down
14 changes: 12 additions & 2 deletions spec/unit/resource/api300/c7000/logical_interconnect_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@
expect(OneviewSDK::Interconnect).to receive(:get_type).with(@client_300, @type)
.and_return('uri' => '/rest/fake')
@item.add_interconnect(3, @type)
expect(@item['interconnectMapTemplate']['interconnectMapEntryTemplates'].first['permittedInterconnectTypeUri'])
.to eq('/rest/fake')

location_entries = @item['interconnectMapTemplate']['interconnectMapEntryTemplates'].first['logicalLocation']['locationEntries']
expect(location_entries.size).to eq(2)

bay_entry, enclosure_entry = location_entries
expect(bay_entry['type']).to eq('Bay')
expect(bay_entry['relativeValue']).to eq(3)
expect(enclosure_entry['type']).to eq('Enclosure')
expect(enclosure_entry['relativeValue']).to eq(1)

permitted_interconnect_type_uri = @item['interconnectMapTemplate']['interconnectMapEntryTemplates'].first['permittedInterconnectTypeUri']
expect(permitted_interconnect_type_uri).to eq('/rest/fake')
end

it 'raises an error if the interconnect is not found' do
Expand Down
12 changes: 6 additions & 6 deletions spec/unit/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
expect { res.like?(nil) }.to raise_error(/Can't compare with object type: NilClass/)
end

context 'when compare similar objects into array' do
context 'when comparing similar objects inside arrays' do
it 'should return true' do
options = { uri: '/rest/fake', list: [{ uri: '/rest/child/1', tag: 'not_to_compare' }, { uri: '/rest/child/2', tag: 'not_to_compare' }] }
res = OneviewSDK::Resource.new(@client_200, options)
Expand All @@ -189,7 +189,7 @@
expect(res.like?(uri: '/rest/fake', list: [])).to eq(true)
end

it 'should return true if value is null' do
it 'should return true if value is nil' do
options = { uri: '/rest/fake', list: nil }
res = OneviewSDK::Resource.new(@client_200, options)
expect(res.like?(uri: '/rest/fake', list: nil)).to eq(true)
Expand All @@ -208,7 +208,7 @@
end
end

context 'when compare different objects into array' do
context 'when comparing different objects inside arrays' do
it 'should return false comparing with wrong value' do
options = { uri: '/rest/fake', list: [{ uri: '/rest/child/1', tag: 'not_to_compare' }, { uri: '/rest/child/2', tag: 'not_to_compare' }] }
res = OneviewSDK::Resource.new(@client_200, options)
Expand All @@ -221,13 +221,13 @@
expect(res.like?(uri: '/rest/fake', list: [])).to eq(false)
end

it 'should return false if current array is empty' do
it 'should return false if the array inside Resource that called the method is empty' do
options = { uri: '/rest/fake', list: [] }
res = OneviewSDK::Resource.new(@client_200, options)
expect(res.like?(uri: '/rest/fake', list: [{ uri: '/rest/child/1' }])).to eq(false)
end

it 'should return false if current value is null' do
it 'should return false if the value of array inside Resource that called the method is nil' do
options = { uri: '/rest/fake', list: nil }
res = OneviewSDK::Resource.new(@client_200, options)
expect(res.like?(uri: '/rest/fake', list: [{ uri: '/rest/child/1' }])).to eq(false)
Expand Down Expand Up @@ -453,7 +453,7 @@
end

context 'when there are many pages' do
context "and, in the last page, body['nextPageUri'] is null" do
context "and, in the last page, body['nextPageUri'] is nil" do
it 'should return all resources' do
fake_response_1 = FakeResponse.new(members: [
{ name: 'Enc1', uri: "#{OneviewSDK::Enclosure::BASE_URI}/1" },
Expand Down

0 comments on commit a4b56f2

Please sign in to comment.