Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
- class ValidationTest
- include ActiveModel::Validations
- before_validate :do_something
- validates_presence_of :something
- def do_something
- raise "callback"
- end
- def something
- raise "validation"
- end
- end
- class ValidationTest2
- include ActiveModel::Validations
- validates_presence_of :something
- before_validate :do_something
- def do_something
- raise "callback"
- end
- def something
- raise "validation"
- end
- end
- describe ValidationTest do
- it "should run the validations properly" do
- p = ValidationTest.new
- lambda { p.valid? }.should raise_error("callback")
- end
- end
- describe ValidationTest2 do
- it "should run the validations properly" do
- p = ValidationTest2.new
- lambda { p.valid? }.should raise_error("callback")
- end
- end
Add Comment
Please, Sign In to add comment