Created
January 30, 2012 11:47
-
-
Save rodrigomaia/1704005 to your computer and use it in GitHub Desktop.
RSpec test Models Validates
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
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