Skip to content

Instantly share code, notes, and snippets.

@gotva
Last active December 23, 2015 02:09
Show Gist options
  • Save gotva/6565446 to your computer and use it in GitHub Desktop.
Save gotva/6565446 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe "User" do
it "should require a phone number" do
user = create(:user).should be_valid
end
it "should require a valid 10 digit phone number" do
user = create(:user).should be_valid
end
# create a record in DB to use shoulda validation test on uniqueness
context 'validates on uniqueness' do
before { create(:user) }
it { should validate_uniqueness_of(:phone_number) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment