Created
May 14, 2016 02:24
-
-
Save sicktastic/ba28c43be278e28ff31cd26c787d169c to your computer and use it in GitHub Desktop.
Sources from Good RSpec
This file contains hidden or 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
# correct | |
describe User do | |
let (:user) { User.new } | |
context "when name is empty" do | |
it "should not be valid" do | |
expect(user.valid?).to be_false | |
end | |
it "should not save" do | |
expect(user.save).to be_false | |
end | |
end | |
context "when name is not empty" do | |
let (:user) { User.new(:name => "Alex") } | |
it "should be valid" do | |
expect(user.valid?).to be_true | |
end | |
it "should save" do | |
expect(user.save).to be_true | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment