How to do it? Could not find examples on the Internet ... (using rspec 2.5.0and rails 3.0.5)
rspec 2.5.0
rails 3.0.5
Found it at shoulda-matchers: http://rubydoc.info/github/thoughtbot/shoulda-matchers/master/frames
shoulda-matchers
before(:each) do @attr = { :bar => "foobar" } end it "should reject duplicate bar" do Foo.create!(@attr) duplicate_bar = Foo.new(@attr) duplicate_bar.should_not be_valid end
, , save update
save
update
@widget.save #untested, but this should be close @widget.errors.full_messages.include?("validation message you are looking for").should be true
, , , , , ( ). , Rails . .