spec/lib/state_spec.rb in geolookup-0.5.0 vs spec/lib/state_spec.rb in geolookup-0.5.1
- old
+ new
@@ -9,9 +9,19 @@
it "should return nil if code doesn't match" do
expect(Geolookup::USA::State.code_to_name(-1)).to be_nil
end
end
+ describe "#name_to_abbreviation" do
+ it "should return name to state abbreviation" do
+ expect(Geolookup::USA::State.name_to_abbreviation('CA')).to eql("California")
+ end
+
+ it "should return nil if no state abbreviation" do
+ expect(Geolookup::USA::State.name_to_abbreviation('asdf')).to be_nil
+ end
+ end
+
describe "#code_to_abbreviation" do
it 'should return a state abbreviation gien a state code' do
expect(Geolookup::USA::State.code_to_abbreviation(1)).to eql("AL")
end
\ No newline at end of file