Skip to content

Instantly share code, notes, and snippets.

@rodrigomaia
Created January 30, 2012 11:47
Show Gist options
  • Save rodrigomaia/1704005 to your computer and use it in GitHub Desktop.
Save rodrigomaia/1704005 to your computer and use it in GitHub Desktop.
RSpec test Models Validates
describe User do
before do
@user = User.new(name: "Example User", email: "user@example.com")
end
.
.
.
describe "when email is not present" do
before { @user.email = " " }
it { should_not be_valid }
end
end
fonte: http://ruby.railstutorial.org/chapters/modeling-users?version=3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment