module Rspec::Core::ExampleGroupSubject
def self.included(kls)
def self.included(kls) kls.extend ClassMethods kls.send :alias_method, :__should_for_example_group__, :should kls.send :alias_method, :__should_not_for_example_group__, :should_not end
def should(matcher=nil, message=nil)
it { should be_eligible_to_vote }
describe Person do
== Examples
expressions.
an implicit subject (see +subject+), this supports very concise
delegated to the object returned by +subject+. Combined with
When +should+ is called with no explicit receiver, the call is
def should(matcher=nil, message=nil) self == subject ? self.__should_for_example_group__(matcher) : subject.should(matcher,message) end
def should_not(matcher=nil, message=nil)
it { should_not be_eligible_to_vote }
describe Person do
== Examples
explicit) of the example group.
Just like +should+, +should_not+ delegates to the subject (implicit or
def should_not(matcher=nil, message=nil) self == subject ? self.__should_not_for_example_group__(matcher) : subject.should_not(matcher,message) end
def subject
def subject @subject ||= self.class.subject.call end