Method: RSpec::Core::MemoizedHelpers#should

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

#should(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 instead of should.

When should is called with no explicit receiver, the call is delegated to the object returned by subject. Combined with an implicit subject this supports very concise expressions.

Examples:


RSpec.describe Person do
  it { should be_eligible_to_vote }
end

See Also:


80
81
82
83
# File 'lib/rspec/core/memoized_helpers.rb', line 80

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