Skip to content

Instantly share code, notes, and snippets.

@base10
Created January 21, 2009 04:00
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 base10/49844 to your computer and use it in GitHub Desktop.
Save base10/49844 to your computer and use it in GitHub Desktop.
## Copyright 2009 Rex Luther Corporation.
## Licensed under the MIT License
## http://www.opensource.org/licenses/mit-license.php
it "should require a phone number have a valid format" do
@contact.phone = '(919) 555-1212'
@contact.should be_valid
@contact.phone = '919-555-1212'
@contact.should be_valid
@contact.phone = '919.555.1212'
@contact.should be_valid
@contact.phone = '919-555-121'
@contact.should_not be_valid
end
it "should allow phone numbers to use an extention " do
@contact.phone = '919-555-1212 x1234'
@contact.should be_valid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment