Method: Spec::Example::Subject::ExampleMethods#should

Defined in:
lib/spec/example/subject.rb

#should(matcher = nil, message = nil) ⇒ Object

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

Examples

describe Person do
  it { should be_eligible_to_vote }
end


90
91
92
# File 'lib/spec/example/subject.rb', line 90

def should(matcher=nil, message=nil)
  self == subject ? self.__should_for_example_group__(matcher) : subject.should(matcher,message)
end