Permalink
Browse files

Merge pull request #13 from PugglePay/master

Do not pollute the global namespace with a Country class. Only require'ing iso3166 (part of countries gem).
  • Loading branch information...
2 parents 530f071 + 19c68e7 commit 873e598f5874710830320bc45be00caaa0311d1e @joost committed Dec 18, 2012
Showing with 9 additions and 5 deletions.
  1. +1 −1 lib/phony_rails.rb
  2. +8 −4 spec/lib/phony_rails_spec.rb
View
@@ -1,5 +1,5 @@
require 'phony'
-require 'countries'
+require 'iso3166'
require 'phony_rails/string_extensions'
require 'validators/phony_validator'
require 'phony_rails/version'
@@ -1,6 +1,10 @@
require 'spec_helper'
describe PhonyRails do
+ it "should not pollute the global namespace with a Country class" do
+ should_not be_const_defined "Country"
+ end
+
describe 'String extensions' do
it "should phony_format a String" do
"31101234123".phony_formatted(:format => :international, :spaces => '-').should eql('+31-10-1234123')
@@ -124,14 +128,14 @@
home.normalized_phone1_method(:country_code => 'NL').should eql('31308612906')
end
- it "should use last passed options" do
+ it "should use last passed options" do
home = Home.new(:phone1_method => "(030) 8 61 29 06")
home.normalized_phone1_method(:country_code => 'NL').should eql('31308612906')
home.normalized_phone1_method(:country_code => 'DE').should eql('49308612906')
home.normalized_phone1_method(:country_code => nil).should eql('49308612906')
end
- it "should use last object method" do
+ it "should use last object method" do
home = Home.new(:phone1_method => "(030) 8 61 29 06")
home.country_code = 'NL'
home.normalized_phone1_method.should eql('31308612906')
@@ -154,6 +158,6 @@
home = Home.new(:phone_number => "+31-(0)10-1234123")
home.valid?.should be_true
home.phone_number_as_normalized.should eql('31101234123')
- end
+ end
end
-end
+end

0 comments on commit 873e598

Please sign in to comment.