On Tuesday, January 11, 2011 6:23:07 AM UTC-5, Dennis Schmidt wrote:
>
> # postcard_spec.rb
> require File.dirname(__FILE__) + '/../spec_helper'
> describe Postcard do
> it {should validate_presence_of(:text)}
> it "should validate presence of text" do
> p = Postcard.new
> p.save!
> p.errors.include?(:text).should be_true
> end
> end
>
If you use the non-bang version of save, the spec passes. IE:
p.save
instead of
p.save!
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.