1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

26 commits

Author SHA1 Message Date
Sean Griffin
b404613c97 Always pass a column with a type object to quote
The only case where we got a column that was not `nil`, but did not
respond to `cast_type` was when type casting the default value during
schema creation. We can look up the cast type, and add that object to
the column definition. Will allow us to consistently rely on the type
objects for type casting in all directions.
2014-06-28 14:50:30 -06:00
Sean Griffin
0336efaae8 Don't use column object for type casting in quoting
We're never going to be able to use the attribute object here, however,
so let's just accept the ugly demeter violation here for now.

Remove test cases which were either redundant with other tests in the
file, or were actually testing the type objects (which are tested
elsewhere)
2014-06-18 06:20:18 -06:00
Sean Griffin
597d9c8af8 Remove checks against column.type in abstract adapter quoting
The intention is to eventually remove `column` from the arguments list
both for `quote` and for `type_cast` entirely. This is the first step
to that end.
2014-05-26 09:04:17 -07:00
Yves Senn
abe91cb3bf prevent global timezone state from leaking out of test cases. 2013-10-25 14:40:57 +02:00
Vipul A M
5ef02de131 Remove redundant string_to_binary from type-casting 2013-08-09 20:04:37 +05:30
Neeraj Singh
a0f0943d3a use method with_active_record_default_timezone 2013-07-29 09:07:55 +05:30
Steve Klabnik
afd4a14332 Revert "Merge pull request #9207 from dylanahsmith/mysql-quote-numeric"
This reverts commit 408227d9c5, reversing
changes made to dca0b57d03.
2013-02-27 08:46:40 -08:00
Dylan Smith
a712e08ebe active_record: Quote numeric values compared to string columns. 2013-02-07 04:59:33 -05:00
Francesco Rodriguez
b5bb35355d fix quoting for ActiveSupport::Duration instances
This patch fixes quoting for ActiveSupport::Duration instances:

    # before
    >> ActiveRecord::Base.connection.quote 30.minutes
    => "'--- 1800\n...\n'"

    # after
    >> ActiveRecord::Base.connection.quote 30.minutes
    => "1800"

Also, adds a test for type casting ActiveSupport::Duration instances.

Related to #1119.
2012-07-04 22:39:16 -05:00
Aaron Patterson
61774e0d49 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
Jon Leighton
253bb6b926 Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases. 2011-06-04 23:47:03 +01:00
Aaron Patterson
1f4dae9daa do not depend on to_yaml being called, but rather depend on YAML being dumped 2011-04-13 11:41:42 -07:00
Pratik Naik
fd1cf13f74 Make serialized fixtures work again 2010-12-29 16:15:45 +00:00
Aaron Patterson
4b2e16ed24 all columns respond to string_to_binary, so no need to check respond_to? 2010-10-12 13:10:52 -07:00
Aaron Patterson
0ca9c836c0 test quoting a string with an unknown column type 2010-10-12 11:43:50 -07:00
Aaron Patterson
98cb754cd7 test quoting multibyte chars object 2010-10-12 11:38:07 -07:00
Aaron Patterson
2681dd81b4 test quoting strings with binary columns 2010-10-12 11:34:21 -07:00
Aaron Patterson
4804cb485c test quoting a string with a float column 2010-10-12 11:30:34 -07:00
Aaron Patterson
50ad7f6561 testing quoting a string for an int column 2010-10-12 11:29:28 -07:00
Aaron Patterson
07b0b5b330 testing crazy object quoting 2010-10-12 11:25:20 -07:00
Aaron Patterson
1ba3489b75 test that dates / times / datetimes call quoted_date 2010-10-12 11:21:35 -07:00
Aaron Patterson
8b33f66891 test quoting of bigdecimals 2010-10-12 11:08:10 -07:00
Aaron Patterson
ba0a6772bb testing floats, fixnum, and bignums 2010-10-11 17:57:47 -07:00
Aaron Patterson
8e8a5f33f4 test quoting nils, true, false, id 2010-10-11 17:52:10 -07:00
Aaron Patterson
2610bcbd94 getting quoted_time under more specific tests 2010-10-11 17:52:10 -07:00
Aaron Patterson
b9d4341bd0 starting to get the quote module under test 2010-10-11 17:52:10 -07:00