Skip to content

Instantly share code, notes, and snippets.

@chrismanderson
Created April 4, 2012 18:34
Show Gist options
  • Save chrismanderson/2304578 to your computer and use it in GitHub Desktop.
Save chrismanderson/2304578 to your computer and use it in GitHub Desktop.
boolean tests
# in model
validates :admin, :inclusion => { :in => [true, false] }
# the test
it "rejects invalid admin state" do
non_admin_user = User.new(@attr.merge(:admin => "is administrator"))
non_admin_user.should_not be_valid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment