From a4b56f2462e09461645de7c82070c75062071e63 Mon Sep 17 00:00:00 2001 From: Ricardo Galeno Date: Thu, 23 Mar 2017 11:00:12 -0300 Subject: [PATCH] Fixes based on PR comments - Changed suggested release to 4.1.1 - Fixed typing errors - Made adjustments to the tests --- CHANGELOG.md | 2 +- .../resource/api200/logical_interconnect_group.rb | 2 +- .../c7000/logical_interconnect_group_spec.rb | 14 ++++++++++++-- spec/unit/resource_spec.rb | 12 ++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51b5e8860..3c7934db4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Unreleased Changes -## Suggested release: v5.0.0 +## Suggested release: v4.1.1 #### New Resources: (none) diff --git a/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb b/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb index 1f8d6cafc..322b9a829 100644 --- a/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb +++ b/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb @@ -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 diff --git a/spec/unit/resource/api300/c7000/logical_interconnect_group_spec.rb b/spec/unit/resource/api300/c7000/logical_interconnect_group_spec.rb index 9891d8e7c..94a5ee9d2 100644 --- a/spec/unit/resource/api300/c7000/logical_interconnect_group_spec.rb +++ b/spec/unit/resource/api300/c7000/logical_interconnect_group_spec.rb @@ -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 diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index badce33c2..13eb0a50e 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -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) @@ -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) @@ -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) @@ -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) @@ -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" },