module Spec::Example::Subject::ExampleMethods
def subject
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
is cached and returned by any subsequent calls to +subject+.
subject block is only executed once per example, the result of which
Returns the subject defined in ExampleGroupMethods#subject. The
def subject @subject ||= instance_eval(&self.class.subject) end