aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/explain_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 18:26:20 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 18:26:53 +0200
commit9617db2078e8a85c8944392c21dd748f932bbd80 (patch)
tree727d60f1d2f9bbb6510483c366f62d75e2647619 /activerecord/test/cases/explain_test.rb
parent4df2b779ddfcb27761c71e00e2b241bfa06a0950 (diff)
downloadrails-9617db2078e8a85c8944392c21dd748f932bbd80.tar.gz
rails-9617db2078e8a85c8944392c21dd748f932bbd80.tar.bz2
rails-9617db2078e8a85c8944392c21dd748f932bbd80.zip
applies new string literal convention in activerecord/test
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
Diffstat (limited to 'activerecord/test/cases/explain_test.rb')
-rw-r--r--activerecord/test/cases/explain_test.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/test/cases/explain_test.rb b/activerecord/test/cases/explain_test.rb
index 6409290e8d..e8816743ea 100644
--- a/activerecord/test/cases/explain_test.rb
+++ b/activerecord/test/cases/explain_test.rb
@@ -1,6 +1,6 @@
-require 'cases/helper'
-require 'models/car'
-require 'active_support/core_ext/string/strip'
+require "cases/helper"
+require "models/car"
+require "active_support/core_ext/string/strip"
if ActiveRecord::Base.connection.supports_explain?
class ExplainTest < ActiveRecord::TestCase
@@ -15,13 +15,13 @@ if ActiveRecord::Base.connection.supports_explain?
end
def test_relation_explain
- message = Car.where(:name => 'honda').explain
+ message = Car.where(:name => "honda").explain
assert_match(/^EXPLAIN for:/, message)
end
def test_collecting_queries_for_explain
queries = ActiveRecord::Base.collecting_queries_for_explain do
- Car.where(:name => 'honda').to_a
+ Car.where(:name => "honda").to_a
end
sql, binds = queries[0]
@@ -30,7 +30,7 @@ if ActiveRecord::Base.connection.supports_explain?
assert_equal 1, binds.length
assert_equal "honda", binds.last.value
else
- assert_match 'honda', sql
+ assert_match "honda", sql
end
end
@@ -47,7 +47,7 @@ if ActiveRecord::Base.connection.supports_explain?
def test_exec_explain_with_binds
sqls = %w(foo bar)
- binds = [[bind_param('wadus', 1)], [bind_param('chaflan', 2)]]
+ binds = [[bind_param("wadus", 1)], [bind_param("chaflan", 2)]]
queries = sqls.zip(binds)
stub_explain_for_query_plans(["query plan foo\n", "query plan bar\n"]) do
@@ -65,14 +65,14 @@ if ActiveRecord::Base.connection.supports_explain?
def test_unsupported_connection_adapter
connection.stub(:supports_explain?, false) do
assert_not_called(base.logger, :warn) do
- Car.where(:name => 'honda').to_a
+ Car.where(:name => "honda").to_a
end
end
end
private
- def stub_explain_for_query_plans(query_plans = ['query plan foo', 'query plan bar'])
+ def stub_explain_for_query_plans(query_plans = ["query plan foo", "query plan bar"])
explain_called = 0
connection.stub(:explain, proc{ explain_called += 1; query_plans[explain_called - 1] }) do