spec/support/shared_examples.rb in zelda-1.0.0 vs spec/support/shared_examples.rb in zelda-1.1.0
- old
+ new
@@ -1,9 +1,13 @@
shared_examples_for "a zelda base model" do
it "should respond to the attributes set in the constructor" do
- @model.foo.should == 'bar'
+ described_class.new(:foo => 'bar').foo.should eq('bar')
end
+ it "should return nil for an attribute set to nil" do
+ described_class.new(:foo => nil).foo.should be_nil
+ end
+
it "should not respond to attributes not set in the constructor" do
- lambda { @model.no_not_here_nope }.should raise_error(NoMethodError)
+ lambda { subject.no_not_here_nope }.should raise_error(NoMethodError)
end
end
\ No newline at end of file