aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLee Bankewitz <lee@weplay.com>2009-08-10 14:51:54 -0400
committerLee Bankewitz <lee@weplay.com>2009-08-10 15:58:54 -0400
commit724b48620c5cf21920717d66eea6e7cd4148b535 (patch)
treeb936ecb0a42eb1d169c404c9d0cac6258906bca1 /spec
parent019f35a266c8e27e6dcf443b3c4d92648b96ce89 (diff)
downloadrails-724b48620c5cf21920717d66eea6e7cd4148b535.tar.gz
rails-724b48620c5cf21920717d66eea6e7cd4148b535.tar.bz2
rails-724b48620c5cf21920717d66eea6e7cd4148b535.zip
Bug fix: Don't use #delegate to declare delegations when intentionally delegating to nil
This accounts for a behavior change after Rails 2.3
Diffstat (limited to 'spec')
-rw-r--r--spec/arel/engines/sql/unit/predicates/equality_spec.rb15
-rw-r--r--spec/connections/mysql_connection.rb2
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/arel/engines/sql/unit/predicates/equality_spec.rb b/spec/arel/engines/sql/unit/predicates/equality_spec.rb
index 688a6a20be..e874d07bf3 100644
--- a/spec/arel/engines/sql/unit/predicates/equality_spec.rb
+++ b/spec/arel/engines/sql/unit/predicates/equality_spec.rb
@@ -41,6 +41,21 @@ module Arel
end
end
end
+
+ describe "when relating to a nil Value" do
+ it "manufactures an IS NULL predicate" do
+ value = nil.bind(@relation1)
+ sql = Equality.new(@attribute1, value).to_sql
+
+ adapter_is :mysql do
+ sql.should be_like(%Q{`users`.`id` IS NULL})
+ end
+
+ adapter_is_not :mysql do
+ sql.should be_like(%Q{"users"."id" IS NULL})
+ end
+ end
+ end
end
end
end
diff --git a/spec/connections/mysql_connection.rb b/spec/connections/mysql_connection.rb
index 6e2950f7dc..bcba2b3843 100644
--- a/spec/connections/mysql_connection.rb
+++ b/spec/connections/mysql_connection.rb
@@ -7,7 +7,7 @@ ActiveRecord::Base.logger = Logger.new("debug.log")
ActiveRecord::Base.configurations = {
'unit' => {
:adapter => 'mysql',
- :username => 'rails',
+ :username => 'root',
:encoding => 'utf8',
:database => 'arel_unit',
}