aboutsummaryrefslogtreecommitdiffstats
path: root/test/support
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-29 17:13:53 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-29 17:13:53 -0300
commitbb05bf01ce7243aba06ba0fd6e7a3da65aa77fbb (patch)
tree435f45b71a5f9ca16710e8efae924ff164b363f8 /test/support
parentde916331c3536db839f844034176bf321d94efa7 (diff)
parent1a2bf3df0e3350142d36a51d351ed38523b9f63c (diff)
downloadrails-bb05bf01ce7243aba06ba0fd6e7a3da65aa77fbb.tar.gz
rails-bb05bf01ce7243aba06ba0fd6e7a3da65aa77fbb.tar.bz2
rails-bb05bf01ce7243aba06ba0fd6e7a3da65aa77fbb.zip
Merge pull request #162 from dylanahsmith/quote-integers
Test quoting integers when comparing a string column with integers.
Diffstat (limited to 'test/support')
-rw-r--r--test/support/fake_record.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/support/fake_record.rb b/test/support/fake_record.rb
index ed4420a2cd..035a7a46cf 100644
--- a/test/support/fake_record.rb
+++ b/test/support/fake_record.rb
@@ -60,9 +60,13 @@ module FakeRecord
end
def quote thing, column = nil
- if column && column.type == :integer
- return 'NULL' if thing.nil?
- return thing.to_i
+ if column && !thing.nil?
+ case column.type
+ when :integer
+ thing = thing.to_i
+ when :string
+ thing = thing.to_s
+ end
end
case thing
@@ -111,6 +115,10 @@ module FakeRecord
def schema_cache
connection
end
+
+ def quote thing, column = nil
+ connection.quote thing, column
+ end
end
class Base