From 4c0a3d48804a363c7e9272519665a21f601b5248 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sat, 24 Feb 2018 17:15:50 +1030 Subject: Arel: rubocop -a --- .../test/cases/arel/support/fake_record.rb | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'activerecord/test/cases/arel/support') diff --git a/activerecord/test/cases/arel/support/fake_record.rb b/activerecord/test/cases/arel/support/fake_record.rb index 75ac1e072f..8620d6fd34 100644 --- a/activerecord/test/cases/arel/support/fake_record.rb +++ b/activerecord/test/cases/arel/support/fake_record.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'date' +require "date" module FakeRecord class Column < Struct.new(:name, :type) end @@ -12,49 +12,49 @@ module FakeRecord def initialize(visitor = nil) @tables = %w{ users photos developers products} @columns = { - 'users' => [ - Column.new('id', :integer), - Column.new('name', :string), - Column.new('bool', :boolean), - Column.new('created_at', :date) + "users" => [ + Column.new("id", :integer), + Column.new("name", :string), + Column.new("bool", :boolean), + Column.new("created_at", :date) ], - 'products' => [ - Column.new('id', :integer), - Column.new('price', :decimal) + "products" => [ + Column.new("id", :integer), + Column.new("price", :decimal) ] } @columns_hash = { - 'users' => Hash[@columns['users'].map { |x| [x.name, x] }], - 'products' => Hash[@columns['products'].map { |x| [x.name, x] }] + "users" => Hash[@columns["users"].map { |x| [x.name, x] }], + "products" => Hash[@columns["products"].map { |x| [x.name, x] }] } @primary_keys = { - 'users' => 'id', - 'products' => 'id' + "users" => "id", + "products" => "id" } @visitor = visitor end - def columns_hash table_name + def columns_hash(table_name) @columns_hash[table_name] end - def primary_key name + def primary_key(name) @primary_keys[name.to_s] end - def data_source_exists? name + def data_source_exists?(name) @tables.include? name.to_s end - def columns name, message = nil + def columns(name, message = nil) @columns[name.to_s] end - def quote_table_name name + def quote_table_name(name) "\"#{name.to_s}\"" end - def quote_column_name name + def quote_column_name(name) "\"#{name.to_s}\"" end @@ -62,7 +62,7 @@ module FakeRecord self end - def quote thing + def quote(thing) case thing when DateTime "'#{thing.strftime("%Y-%m-%d %H:%M:%S")}'" @@ -73,7 +73,7 @@ module FakeRecord when false "'f'" when nil - 'NULL' + "NULL" when Numeric thing else @@ -89,7 +89,7 @@ module FakeRecord attr_reader :spec, :connection def initialize - @spec = Spec.new(:adapter => 'america') + @spec = Spec.new(adapter: "america") @connection = Connection.new @connection.visitor = Arel::Visitors::ToSql.new(connection) end @@ -98,7 +98,7 @@ module FakeRecord yield connection end - def table_exists? name + def table_exists?(name) connection.tables.include? name.to_s end @@ -110,7 +110,7 @@ module FakeRecord connection end - def quote thing + def quote(thing) connection.quote thing end end -- cgit v1.2.3