Skip to content

Commit

Permalink
Add a spec to make sure we're nil-safe. [#41]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Oct 20, 2009
1 parent f82d0ee commit b4cfd43
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/models/address_spec.rb
Expand Up @@ -106,6 +106,12 @@
country = mock_model(Country, :name => 'US')
Address.new(:state => mock_model(State, :country => country)).country.should == country
end

it "should not complain if methods are called on it, even if nil" do
a = Address.new
a.country.should be_nil
lambda{a.country.code}.should_not raise_error
end
end

describe 'state' do
Expand Down

0 comments on commit b4cfd43

Please sign in to comment.