Created
June 6, 2009 22:53
-
-
Save chrisconley/125032 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
Spec::Matchers.define :require do |attribute| | |
match do |object| | |
factory = object.class.name.downcase.to_sym | |
object = Factory.build(factory, attribute => "") | |
!object.valid? | |
end | |
end | |
describe User do | |
it "should be valid given valid attributes" do | |
user = Factory.build(:user) | |
user.should be_valid | |
end | |
it {should require(:email)} | |
it {should require(:password)} | |
it {should require(:password_confirmation)} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment