Created
May 20, 2010 00:19
-
-
Save fauxparse/407034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment