Created
July 31, 2015 12:16
-
-
Save gin0606/8be6a6bff91b7493e21f to your computer and use it in GitHub Desktop.
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
RSpec.describe User do | |
it "should be valid if it's the correct parameters" do | |
expect(build(:user)).to be_valid | |
end | |
context "when screen_name is not present" do | |
before { @user = build(:user, screen_name: "") } | |
it "should not be valid" do | |
expect(@user).not_to be_valid | |
end | |
end | |
context "when screen_name exceeds 15 characters" do | |
before { @user = build(:user, screen_name: "c" * 16) } | |
it "should not be valid" do | |
expect(@user).not_to be_valid | |
end | |
end | |
context "when name is not present" do | |
before { @user = build(:user, name: "") } | |
it "should not be valid" do | |
expect(@user).not_to be_valid | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment