Add and apply RSpec/ReceiveMessages rubocop rule

This rule was added in rubocop-rspec 2.23.0. I didn't know this method
existed, and it makes the code more readable in some cases.
This commit is contained in:
Javi Martín
2023-09-08 13:26:15 +02:00
parent 9bb2bfdd06
commit 1d5f03be8c
10 changed files with 30 additions and 39 deletions

View File

@@ -39,22 +39,19 @@ describe ManagerAuthenticator do
describe "#auth" do
it "returns false if not manager_exists" do
allow(authenticator).to receive(:manager_exists?).and_return(false)
allow(authenticator).to receive(:application_authorized?).and_return(true)
allow(authenticator).to receive_messages(manager_exists?: false, application_authorized?: true)
expect(authenticator.auth).to be false
end
it "returns false if not application_authorized" do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(false)
allow(authenticator).to receive_messages(manager_exists?: true, application_authorized?: false)
expect(authenticator.auth).to be false
end
it "returns ok if manager_exists and application_authorized" do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(true)
allow(authenticator).to receive_messages(manager_exists?: true, application_authorized?: true)
expect(authenticator.auth).to be_truthy
end