Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
remove an obsolete check on model attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wong authored and James Wong committed Jul 11, 2017
1 parent 890e08a commit 1a58011
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
6 changes: 1 addition & 5 deletions lib/ansible_tower_client/base_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions spec/support/shared_examples/crud_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1a58011

Please sign in to comment.