spec/countries_spec.rb in countries-0.1.0 vs spec/countries_spec.rb in countries-0.1.1

- old
+ new

@@ -1,10 +1,10 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Country do before(:all) do - @country = Country['US'] + @country = Country.search('US') end it 'should return 3166 number' do @country.number.should == '840' end @@ -61,11 +61,21 @@ it 'should return national_prefix' do @country.national_prefix.should == '1' end end - describe '[]' do - it 'should return new country object when a alpha2 is passed' do - Country['US'].should be_a(Country) + describe '.subdivisions' do + it 'should return an empty hash for a country with no ISO3166-2' do + Country.search('VA').subdivisions.should have(0).subdivisions + end + + it 'should return a hash with all sub divisions' do + @country.subdivisions.should have(57).states + end + end + + describe '.search' do + it 'should return new country object when a valid alpha2 is passed' do + Country.search('US').should be_a(Country) end end end