lib/rubocop/cop/rspec/unspecified_exception.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/unspecified_exception.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -8,29 +8,29 @@
# Enforces one of an Exception type, a string, or a regular
# expression to match against the exception message as a parameter
# to `raise_error`
#
# @example
+ # # bad
+ # expect {
+ # raise StandardError.new('error')
+ # }.to raise_error
#
- # # bad
- # expect {
- # raise StandardError.new('error')
- # }.to raise_error
+ # # good
+ # expect {
+ # raise StandardError.new('error')
+ # }.to raise_error(StandardError)
#
- # # good
- # expect {
- # raise StandardError.new('error')
- # }.to raise_error(StandardError)
+ # expect {
+ # raise StandardError.new('error')
+ # }.to raise_error('error')
#
- # expect {
- # raise StandardError.new('error')
- # }.to raise_error('error')
+ # expect {
+ # raise StandardError.new('error')
+ # }.to raise_error(/err/)
#
- # expect {
- # raise StandardError.new('error')
- # }.to raise_error(/err/)
+ # expect { do_something }.not_to raise_error
#
- # expect { do_something }.not_to raise_error
class UnspecifiedException < Base
MSG = 'Specify the exception being captured'
RESTRICT_ON_SEND = %i[to].freeze
# @!method empty_raise_error_or_exception(node)