Skip to content

Commit

Permalink
rspec testing that exec_api_call accepts Hash as result object
Browse files Browse the repository at this point in the history
  • Loading branch information
yrudman committed Nov 15, 2018
1 parent c4559ac commit 59b2870
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/models/mixins/inter_region_api_method_relay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ def expect_api_call(expected_action, expected_args = nil)
}.to raise_error(described_class::InterRegionApiMethodRelayError)
end

it "accepts Hash object as api result" do
expect(api_collection).to receive(action).and_return({})
expect {
described_class.exec_api_call(region, collection_name, action)
}.not_to raise_error(described_class::InterRegionApiMethodRelayError)
end

it "calls the given action with the given args" do
args = {:my => "args", :here => 123}
expect(api_collection).to receive(action).with(args).and_return(api_success_result)
Expand Down

0 comments on commit 59b2870

Please sign in to comment.