Skip to content

Instantly share code, notes, and snippets.

@jnstq
Created May 23, 2011 21:03
Show Gist options
  • Save jnstq/987601 to your computer and use it in GitHub Desktop.
Save jnstq/987601 to your computer and use it in GitHub Desktop.
it "normalize swedish cell phone number" do
user = Factory.build(:user, :cell_phone => "0707-293274")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "0046707293274"
user = Factory.build(:user, :cell_phone => "+46707-293274")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "0046707293274"
user = Factory.build(:user, :cell_phone => "0046707293274")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "0046707293274"
end
it "normalize finnish cell phone number" do
user = Factory.build(:user, :cell_phone => "04123456789")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "003584123456789"
user = Factory.build(:user, :cell_phone => "05123456789")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "003585123456789"
user = Factory.build(:user, :cell_phone => "+3585123456789")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "003585123456789"
user = Factory.build(:user, :cell_phone => "003585123456789")
described_class.new(:recipient => user).recipient_normalized_cell_phone.should == "003585123456789"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment