aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/quoting_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate using `#quoted_id` in quotingRyuta Kamizono2017-02-241-1/+1
| | | | | Originally `quoted_id` was used in legacy quoting mechanism. Now we use type casting mechanism for that. Let's deprecate `quoted_id`.
* Fix type casting AR object to respect the primary key cast type's serializationRyuta Kamizono2017-02-241-0/+27
|
* Extract `TypeCastingTest` into `test/cases/quoting_test.rb`Ryuta Kamizono2017-02-241-0/+56
|
* Remove deprecated support to passing a column to #quoteRafael Mendonça França2016-12-291-12/+12
|
* Move `test_quoting_classes` into `test/cases/quoting_test.rb`Ryuta Kamizono2016-10-291-0/+4
|
* Remove useless `test_string_with_crazy_column`Ryuta Kamizono2016-09-111-6/+2
| | | | | | Passing `FakeColumn` was removed at #15336 therefore `test_string_with_crazy_column` is duplicated with `test_quote_string_no_column`.
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-7/+7
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Quoting booleans should return a frozen stringRyuta Kamizono2016-07-271-0/+16
| | | | | | | | | | | | | | | | | | | If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the following issue. ``` Loading development environment (Rails 5.1.0.alpha) irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo' => "1 foo" irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo' => "1 foo foo" irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new => #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil> irb(main):004:0> type.serialize(true) << ' bar' => "1 foo foo bar" irb(main):005:0> type.cast(true) << ' bar' => "1 foo foo bar bar" ```
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-3/+3
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Refactor microsecond precision to be database agnosticSean Griffin2015-02-101-5/+5
| | | | | | | | | | The various databases don't actually need significantly different handling for this behavior, and they can achieve it without knowing about the type of the object. The old implementation was returning a string, which will cause problems such as breaking TZ aware attributes, and making it impossible for the adapters to supply their logic for time objects.
* Don't default to YAML dumping when quoting valuesSean Griffin2015-01-141-8/+5
| | | | | | | This behavior exists only to support fixtures, so we should handle it there. Leaving it in `#quote` can cause very subtle bugs to slip through, by things appearing to work when they should be blowing up loudly, such as #18385.
* Always pass a column with a type object to quoteSean Griffin2014-06-281-11/+0
| | | | | | | | 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.
* Don't use column object for type casting in `quoting`Sean Griffin2014-06-181-25/+0
| | | | | | | | | 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)
* Remove checks against `column.type` in abstract adapter quotingSean Griffin2014-05-261-18/+10
| | | | | | 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.
* prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-5/+5
|
* Remove redundant `string_to_binary` from type-castingVipul A M2013-08-091-19/+0
|
* use method with_active_record_default_timezoneNeeraj Singh2013-07-291-30/+20
|
* Revert "Merge pull request #9207 from dylanahsmith/mysql-quote-numeric"Steve Klabnik2013-02-271-7/+7
| | | | | This reverts commit 408227d9c5ed7de26310d72a1a99c1ee02311c63, reversing changes made to dca0b57d03deffc933763482e615c3cf0b9a1d97.
* active_record: Quote numeric values compared to string columns.Dylan Smith2013-02-071-7/+7
|
* fix quoting for ActiveSupport::Duration instancesFrancesco Rodriguez2012-07-041-0/+8
| | | | | | | | | | | | | | | | 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.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | 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.
* do not depend on to_yaml being called, but rather depend on YAML being dumpedAaron Patterson2011-04-131-6/+7
|
* Make serialized fixtures work againPratik Naik2010-12-291-2/+2
|
* all columns respond to string_to_binary, so no need to check respond_to?Aaron Patterson2010-10-121-3/+8
|
* test quoting a string with an unknown column typeAaron Patterson2010-10-121-0/+4
|
* test quoting multibyte chars objectAaron Patterson2010-10-121-0/+20
|
* test quoting strings with binary columnsAaron Patterson2010-10-121-0/+13
|
* test quoting a string with a float columnAaron Patterson2010-10-121-0/+5
|
* testing quoting a string for an int columnAaron Patterson2010-10-121-0/+12
|
* testing crazy object quotingAaron Patterson2010-10-121-0/+12
|
* test that dates / times / datetimes call quoted_dateAaron Patterson2010-10-121-0/+10
|
* test quoting of bigdecimalsAaron Patterson2010-10-121-0/+6
|
* testing floats, fixnum, and bignumsAaron Patterson2010-10-111-0/+18
|
* test quoting nils, true, false, idAaron Patterson2010-10-111-0/+20
|
* getting quoted_time under more specific testsAaron Patterson2010-10-111-0/+65
|
* starting to get the quote module under testAaron Patterson2010-10-111-0/+30