From 699b2f6f691689dbd48dd78ca847eceb65be3ea1 Mon Sep 17 00:00:00 2001 From: James Wong <jwong@jwong-OSX.local> Date: Tue, 11 Jul 2017 16:08:30 -0400 Subject: [PATCH] remove an obsolete check on model attributes --- lib/ansible_tower_client/base_model.rb | 6 +----- spec/support/shared_examples/crud_methods.rb | 6 ------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/ansible_tower_client/base_model.rb b/lib/ansible_tower_client/base_model.rb index 31a7136..a7f83ee 100644 --- a/lib/ansible_tower_client/base_model.rb +++ b/lib/ansible_tower_client/base_model.rb @@ -95,11 +95,7 @@ def update_attributes!(attributes) @api.patch(url, attributes.to_json) attributes.each do |method_name, value| invoke_name = "#{override_raw_attributes[method_name] || method_name}=" - if respond_to?(invoke_name) - send(invoke_name, value) - else - AnsibleTowerClient.logger.warn("Unknown attribute/method: #{invoke_name}. Skip updating it ...") - end + send(invoke_name, value) end true end diff --git a/spec/support/shared_examples/crud_methods.rb b/spec/support/shared_examples/crud_methods.rb index 267bcba..f65da30 100644 --- a/spec/support/shared_examples/crud_methods.rb +++ b/spec/support/shared_examples/crud_methods.rb @@ -37,12 +37,6 @@ expect(obj.name).to eq 'blah' end - it "ignore unknown attributes if patch succeeds" do - expect(instance_api).to receive(:patch).and_return(instance_double("Faraday::Result", :body => raw_instance.to_json)) - expect(obj.update_attributes!(:name => 'blah', :stranger_thing => 'bomb')).to eq true - expect(obj.name).to eq 'blah' - end - it "returns an error if an error is raised" do expect(instance_api).to receive(:patch).and_raise(AnsibleTowerClient::Error, 'error') expect { obj.update_attributes!(:name => 'bad name') }.to raise_error(AnsibleTowerClient::Error)