-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warnings triggered by raise_error matcher #144
Conversation
@@ -299,7 +299,7 @@ def perform(sqs_msg, body); end | |||
it 'does not extend the message invisibility' do | |||
expect(sqs_msg).to receive(:visibility_timeout=).never | |||
expect_any_instance_of(TestWorker).to receive(:perform).and_raise 'worker failed' | |||
expect { subject.process(queue, sqs_msg) }.to raise_error | |||
expect { subject.process(queue, sqs_msg) }.to raise_error(RuntimeError, "worker failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Fix warnings that are triggered when the `raise_error` matcher is used without providing a specific error class or message. The warning quoted: >WARNING: Using the `raise_error` matcher without providing a specific error or >message risks false positives, since `raise_error` will match when Ruby raises >a `NoMethodError`, `NameError` or `ArgumentError`, potentially allowing the >expectation to pass without even executing the method you are intending to >call. Instead consider providing a specific error class or message. This >message can be supressed by setting: >`RSpec::Expectations.configuration.warn_about_potential_false_positives = >false`.
@@ -33,7 +35,9 @@ | |||
|
|||
expect(sqs_msg).not_to receive(:change_visibility) | |||
|
|||
expect { subject.call(TestWorker.new, queue, sqs_msg, sqs_msg.body) { raise } }.to raise_error | |||
expect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using {...}
for multi-line blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix warnings triggered by raise_error matcher
Cool. Added to master 🍻 |
Fix warnings that are triggered when the
raise_error
matcheris used without providing a specific error class or message.
The warning quoted: