aboutsummaryrefslogtreecommitdiffstats
path: root/spec/doubles
diff options
context:
space:
mode:
Diffstat (limited to 'spec/doubles')
-rw-r--r--spec/doubles/database.rb51
-rw-r--r--spec/doubles/hash.rb8
2 files changed, 4 insertions, 55 deletions
diff --git a/spec/doubles/database.rb b/spec/doubles/database.rb
deleted file mode 100644
index f8a4b38e17..0000000000
--- a/spec/doubles/database.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-module Fake
- class Engine
- def connection
- @conn ||= Connection.new
- end
- end
-
- class Connection
- include ActiveRecord::ConnectionAdapters::Quoting
-
- def columns(table_name, comment)
- { "users" =>
- [
- Column.new("id", :integer),
- Column.new("name", :string)
- ],
- "photos" =>
- [
- Column.new("id", :integer),
- Column.new("user_id", :integer),
- Column.new("camera_id", :integer)
- ]
- }[table_name]
- end
-
- def execute(*args)
- []
- end
-
- def quote_column_name(column_name)
- "`#{column_name}`"
- end
-
- def quote_table_name(table_name)
- "`#{table_name}`"
- end
-
- def supports_count_distinct?
- true
- end
- end
-
- class Column
- attr_reader :name, :type
-
- def initialize(name, type)
- @name = name
- @type = type
- end
- end
-end
diff --git a/spec/doubles/hash.rb b/spec/doubles/hash.rb
index 97d25742cb..32c5b98058 100644
--- a/spec/doubles/hash.rb
+++ b/spec/doubles/hash.rb
@@ -2,19 +2,19 @@ class Hash
def ordered_array
to_a.sort { |(key1, value1), (key2, value2)| key1.hash <=> key2.hash }
end
-
+
def keys
ordered_array.collect(&:first)
end
-
+
def values
ordered_array.collect { |_, v| v }
end
-
+
def each(&block)
ordered_array.each(&block)
end
-
+
def shift
returning to_a.first do |k, v|
delete(k)