diff options
author | Carl Lerche <carllerche@mac.com> | 2010-04-03 10:40:46 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-04-03 10:40:46 -0700 |
commit | e5454e8d8adcf53829a44702f2328f8ea119a16a (patch) | |
tree | 3735541ae1d3f452597de79208b1cf35dd114ef0 /spec/attributes | |
parent | 406fa3d37e8a531bec5646a46a7d109f6ed8c345 (diff) | |
download | rails-e5454e8d8adcf53829a44702f2328f8ea119a16a.tar.gz rails-e5454e8d8adcf53829a44702f2328f8ea119a16a.tar.bz2 rails-e5454e8d8adcf53829a44702f2328f8ea119a16a.zip |
Return nil when looking up an attribute by name that does not exist instead of returning a fictitious attribute.
Diffstat (limited to 'spec/attributes')
-rw-r--r-- | spec/attributes/header_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/attributes/header_spec.rb b/spec/attributes/header_spec.rb index 5811041734..8fb4007003 100644 --- a/spec/attributes/header_spec.rb +++ b/spec/attributes/header_spec.rb @@ -18,8 +18,15 @@ module Arel end end - it "finds attributes by name" do - @relation.attributes[:name].should == Attributes::String.new(@relation, :name) + describe "attribute lookup" do + it "finds attributes by name" do + @relation.attributes[:name].should == Attributes::String.new(@relation, :name) + end + + it "returns nil if no attribute is found" do + @relation.attributes[:does_not_exist].should be_nil + @relation[:does_not_exist].should be_nil + end end describe "#union" do |