aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/arel/support
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2018-02-24 17:15:50 +1030
committerMatthew Draper <matthew@trebex.net>2018-02-24 17:16:13 +1030
commit4c0a3d48804a363c7e9272519665a21f601b5248 (patch)
tree6b1f6e28f85cfd69a0ce534856ef939c7079d5cf /activerecord/test/cases/arel/support
parent17ca17072dcdff11b3702a6b45f2fb0c8f8fe9a4 (diff)
downloadrails-4c0a3d48804a363c7e9272519665a21f601b5248.tar.gz
rails-4c0a3d48804a363c7e9272519665a21f601b5248.tar.bz2
rails-4c0a3d48804a363c7e9272519665a21f601b5248.zip
Arel: rubocop -a
Diffstat (limited to 'activerecord/test/cases/arel/support')
-rw-r--r--activerecord/test/cases/arel/support/fake_record.rb48
1 files changed, 24 insertions, 24 deletions
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