diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/attributes/header_spec.rb | 11 | ||||
-rw-r--r-- | spec/engines/sql/unit/primitives/attribute_spec.rb | 19 |
2 files changed, 9 insertions, 21 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 diff --git a/spec/engines/sql/unit/primitives/attribute_spec.rb b/spec/engines/sql/unit/primitives/attribute_spec.rb index c467d902ad..9f864dd3a1 100644 --- a/spec/engines/sql/unit/primitives/attribute_spec.rb +++ b/spec/engines/sql/unit/primitives/attribute_spec.rb @@ -31,25 +31,6 @@ module Arel end end end - - describe 'for an inexistent attribute' do - it "manufactures sql" do - sql = @relation[:does_not_exist].to_sql - - adapter_is :mysql do - sql.should be_like(%Q{`users`.`does_not_exist`}) - end - - adapter_is :oracle do - sql.should be_like(%Q{"USERS"."DOEST_NOT_EXIST"}) - end - - adapter_is_not :mysql, :oracle do - sql.should be_like(%Q{"users"."does_not_exist"}) - end - end - end - end end end |