module RSpec::Core::Subject::InstanceMethods

def should(matcher=nil, message=nil)

end
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)

end
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

end
end
subject.should be_eligible_to_vote
it "should be eligible to vote" do
describe Person do
# implicit subject => { Person.new }

end
end
subject.should be_eligible_to_vote
it "should be eligible to vote" do
subject { Person.new(:birthdate => 19.years.ago) }
describe Person do
# explicit subject defined by the subject method

== Examples

instance of that class.
declared in the example group, then +subject+ will return a new
If a class is passed to +describe+ and no subject is explicitly

returned by any subsequent calls to +subject+.
only executed once per example, the result of which is cached and
Returns the subject defined by the example group. The subject block is
def subject
  if defined?(@original_subject)
    @original_subject
  else
    @original_subject = instance_eval(&self.class.subject)
  end
end