Skip to content

Instantly share code, notes, and snippets.

@gin0606
Created July 31, 2015 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gin0606/8be6a6bff91b7493e21f to your computer and use it in GitHub Desktop.
Save gin0606/8be6a6bff91b7493e21f to your computer and use it in GitHub Desktop.
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