diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:26:20 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:26:53 +0200 |
commit | 9617db2078e8a85c8944392c21dd748f932bbd80 (patch) | |
tree | 727d60f1d2f9bbb6510483c366f62d75e2647619 /activerecord/test/cases/bind_parameter_test.rb | |
parent | 4df2b779ddfcb27761c71e00e2b241bfa06a0950 (diff) | |
download | rails-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/bind_parameter_test.rb')
-rw-r--r-- | activerecord/test/cases/bind_parameter_test.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 3f01885489..97d080b2a3 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -1,7 +1,7 @@ -require 'cases/helper' -require 'models/topic' -require 'models/author' -require 'models/post' +require "cases/helper" +require "models/topic" +require "models/author" +require "models/post" module ActiveRecord class BindParameterTest < ActiveRecord::TestCase @@ -24,7 +24,7 @@ module ActiveRecord @connection = ActiveRecord::Base.connection @subscriber = LogListener.new @pk = Topic.columns_hash[Topic.primary_key] - @subscription = ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber) + @subscription = ActiveSupport::Notifications.subscribe("sql.active_record", @subscriber) end teardown do @@ -34,8 +34,8 @@ module ActiveRecord if ActiveRecord::Base.connection.supports_statement_cache? && ActiveRecord::Base.connection.prepared_statements def test_bind_from_join_in_subquery - subquery = Author.joins(:thinking_posts).where(name: 'David') - scope = Author.from(subquery, 'authors').where(id: 1) + subquery = Author.joins(:thinking_posts).where(name: "David") + scope = Author.from(subquery, "authors").where(id: 1) assert_equal 1, scope.count end @@ -44,7 +44,7 @@ module ActiveRecord binds = [Relation::QueryAttribute.new("id", 1, Type::Value.new)] sql = "select * from topics where id = #{sub.to_sql}" - @connection.exec_query(sql, 'SQL', binds) + @connection.exec_query(sql, "SQL", binds) message = @subscriber.calls.find { |args| args[4][:sql] == sql } assert_equal binds, message[4][:binds] @@ -53,20 +53,20 @@ module ActiveRecord def test_find_one_uses_binds Topic.find(1) message = @subscriber.calls.find { |args| args[4][:binds].any? { |attr| attr.value == 1 } } - assert message, 'expected a message with binds' + assert message, "expected a message with binds" end def test_logs_bind_vars_after_type_cast binds = [Relation::QueryAttribute.new("id", "10", Type::Integer.new)] type_casted_binds = binds.map { |attr| type_cast(attr.value_for_database) } payload = { - :name => 'SQL', - :sql => 'select * from topics where id = ?', + :name => "SQL", + :sql => "select * from topics where id = ?", :binds => binds, :type_casted_binds => type_casted_binds } event = ActiveSupport::Notifications::Event.new( - 'foo', + "foo", Time.now, Time.now, 123, |