I have the following spec:
context "no firstname present" do
let(:contact) { build :contact, firstname: 'Mickey', lastname: '', companyname: '' }
it "should be valid" do
should be_valid # Does not work
contact.should be_valid # Works
end
end
Why does should be_valid fails, but contact.should be_valid passes? Within the it block, should be_valid should access contact anyway?! Thanks for clarification.
You could use
subjectEdit
I just discovered
its[link] which is a great way to test thesubject‘s attributes or test messages sent to it