Skip to content

Instantly share code, notes, and snippets.

@chrisconley
Created June 6, 2009 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisconley/125032 to your computer and use it in GitHub Desktop.
Save chrisconley/125032 to your computer and use it in GitHub Desktop.
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