Enable RSpec/MessageExpectation cop & fix issues

There was 34 `allow` occurences and 17 `expect` occurences, so to be consistent `allow` form was chosen.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
This commit is contained in:
Bertocq
2018-01-07 16:31:01 +01:00
parent 987b31d618
commit c4aa2d7093
9 changed files with 22 additions and 19 deletions

View File

@@ -46,7 +46,7 @@ describe CensusApi do
it "returns the response for the first valid variant" do
allow(api).to receive(:get_response_body).with(1, "00123456").and_return(invalid_body)
allow(api).to receive(:get_response_body).with(1, "123456").and_return(invalid_body)
expect(api).to receive(:get_response_body).with(1, "0123456").and_return(valid_body)
allow(api).to receive(:get_response_body).with(1, "0123456").and_return(valid_body)
response = api.call(1, "123456")
@@ -55,9 +55,9 @@ describe CensusApi do
end
it "returns the last failed response" do
expect(api).to receive(:get_response_body).with(1, "00123456").and_return(invalid_body)
expect(api).to receive(:get_response_body).with(1, "123456").and_return(invalid_body)
expect(api).to receive(:get_response_body).with(1, "0123456").and_return(invalid_body)
allow(api).to receive(:get_response_body).with(1, "00123456").and_return(invalid_body)
allow(api).to receive(:get_response_body).with(1, "123456").and_return(invalid_body)
allow(api).to receive(:get_response_body).with(1, "0123456").and_return(invalid_body)
response = api.call(1, "123456")
expect(response).to_not be_valid