Method: RSpec::Core::MemoizedHelpers#should_not

Defined in:
lib/rspec/core/memoized_helpers.rb

#should_not(matcher = nil, message = nil) ⇒ void

Note:

This only works if you are using rspec-expectations.

Note:

If you are using RSpec's newer expect-based syntax you may want to use is_expected.to_not instead of should_not.

Just like should, should_not delegates to the subject (implicit or explicit) of the example group.

Examples:


RSpec.describe Person do
  it { should_not be_eligible_to_vote }
end

See Also:


100
101
102
103
# File 'lib/rspec/core/memoized_helpers.rb', line 100

def should_not(matcher=nil, message=nil)
  enforce_value_expectation(matcher, 'should_not')
  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
end