diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-26 12:41:52 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-26 12:41:52 -0300 |
commit | c9bbea6115be520dbd47bd30108c5622289deb26 (patch) | |
tree | ec418e01954c1bd2dcfebc7fbc8220fb04b50baf /spec/doubles | |
parent | ae1e0ac5e98a7e5a2894d0a431f8c34af6575cae (diff) | |
parent | 86364591af807ed3fa4a7304f53e6f3458cb4961 (diff) | |
download | rails-c9bbea6115be520dbd47bd30108c5622289deb26.tar.gz rails-c9bbea6115be520dbd47bd30108c5622289deb26.tar.bz2 rails-c9bbea6115be520dbd47bd30108c5622289deb26.zip |
Merge commit 'brynary/master'
Conflicts:
lib/arel.rb
lib/arel/session.rb
Diffstat (limited to 'spec/doubles')
-rw-r--r-- | spec/doubles/database.rb | 51 | ||||
-rw-r--r-- | spec/doubles/hash.rb | 8 |
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) |