aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
Commit message (Collapse)AuthorAgeFilesLines
...
| * | use `force_encoding` instread of `encode!` to avoid `UndefinedConversionError`yuuji.yaginuma2016-11-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `PG::TextEncoder::Array#encode` returns the encoded value with `ASCII-8BIT`. But in some cases, trying to convert `ASCII-8BIT` to `UTF-8` cause an error. ```ruby "{\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB}".encode!(Encoding::UTF_8) # => Encoding::UndefinedConversionError: "\xE3" from ASCII-8BIT to UTF-8 ``` Should use `force_encoding` to avoid this error. Follow up to 7ba3a48df5bfdc5e98506bb829f937e03b55a5b3 Ref: https://github.com/rails/rails/pull/23619#issuecomment-189924036
* | | Fix mucking of connection_config leading to issues in prepared_statementsVipul A M2016-11-171-3/+3
| | |
* | | Fix PG prepared statement testVipul A M2016-11-171-1/+2
| | |
* | | Support AC::Parameters for PG HStoreJon Moss2016-11-151-0/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported via #26904, there is a regression in how values for Postgres' HStore column type are being processed, beginning in Rails 5. Currently, the way that Active Record checks whether or not values need to be serialized and put into the correct storage format is whether or not it is a `Hash` object. Since `ActionController::Parameters` no longer inherits from `Hash` in Rails 5, this conditional now returns false. To remedy this, we are now checking to see whether the `value` parameters being passed in responds to a certain method, and then calling the `serialize` method, except this time with a real Hash object. Keeping things DRY! Fixes #26904.
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-2913-55/+55
| |
* | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-261-1/+1
| | | | | | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* | Fix brittle tests which were relying on the error message text from mysql2 gemPrathamesh Sonpatki2016-10-231-4/+4
| | | | | | | | | | | | | | - These tests were fixed earlier on master in https://github.com/rails/rails/commit/f13ec72664fd13d33d617103ca964a7592295854. - They started failing in first place due to change in https://github.com/brianmario/mysql2/commit/f14023fcfee9e85e6fc1b0e568048811518f8c23. - They will fail again when the message is changed in mysql2 so let's not rely on the error message.
* | Update mysql adapter error message when disconnectedGuillermo Iguaran2016-10-221-2/+2
| |
* | Fix `warning: ambiguous first argument`Ryuta Kamizono2016-10-121-4/+4
| | | | | | | | | | | | | | | | | | ``` test/cases/adapters/postgresql/case_insensitive_test.rb:12: warning: ambiguous first argument; put parentheses or a space even after `/' operator test/cases/adapters/postgresql/case_insensitive_test.rb:16: warning: ambiguous first argument; put parentheses or a space even after `/' operator test/cases/adapters/postgresql/case_insensitive_test.rb:20: warning: ambiguous first argument; put parentheses or a space even after `/' operator test/cases/adapters/postgresql/case_insensitive_test.rb:24: warning: ambiguous first argument; put parentheses or a space even after `/' operator ```
* | Merge pull request #26208 from nanaya/pg-insensitive-textMatthew Draper2016-10-111-0/+26
|\ \ | | | | | | | | | Fix case insensitive check for text column in pg
| * | Fix case insensitive check for text column in pgnanaya2016-09-011-0/+26
| | | | | | | | | | | | There's no 'text to text' casting in the cast table so the feature detection fails.
* | | Simplify serializable test to avoid mystery deadlockMatthew Draper2016-10-071-23/+21
| |/ |/|
* | Make PG deadlock error more deterministicMatthew Draper2016-10-011-9/+12
| | | | | | | | | | We've seen occasional Travis failures mentioning deadlocks. I think they're escaping from this test.
* | Serialize JSON attribute value nil as SQL NULL, not JSON 'null'Trung Duc Tran2016-09-232-0/+32
| | | | | | | | | | | | Test: JSON attribute value nil can be used in where(attr: nil) Add changelog entry
* | improve error message when include assertions failMichael Grosser2016-09-163-4/+4
| | | | | | | | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* | Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-3/+3
| | | | | | | | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* | Address `warning: ambiguous first argument; put parentheses or a space even ↵Yasuo Honda2016-09-131-2/+2
| | | | | | | | after `/' operator`
* | activerecord/mysql2: Avoid setting @connection to nil, just close itDylan Thacker-Smith2016-09-081-0/+21
| | | | | | | | | | | | | | | | | | | | By doing `@connection = nil` that means that we need nil checks before it is used anywhere, but we weren't doing those checks. Instead, we get a NoMethodError after using a connection after it fails to reconnect. Neither of the other adapters set @connection to nil, just the mysql2 adapter. By just closing it, we avoid the need to check if we have a connection object and it will produce an appropriate exception when used.
* | Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-032-7/+7
|/ | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* Remove deprecated handling of PG PointsSean Griffin2016-08-311-12/+0
| | | | | | | | | | There are some minor changes to the point type as I had forgotten that this will affect the behavior of `t.point` in migrations and the schema dumper so we need to handle those as well. I'll say this again so I can convince myself to come up with a better structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO BETTER SEPARATE THESE.
* Attempt to maintain encoding for arrays of strings with PGSean Griffin2016-08-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | I still think that this is something that should be handled in the pg gem, but it's not going to end up happening there so we'll do it here instead. Once we bump to pg 0.19 we can pass the encoding to the `encode` method instead. This issue occurs because C has no concept of encoding (or strings, really). The bytes that we pass here when sending the value to the database will always be interpreted as whatever encoding the connection is currently configured to use. That means that roundtripping to the database will lose no information However, after assigning we round trip through our type system without hitting the database. The only way that we can do the "correct" thin here would be to actually give a reference to the connection to the array type and have it check the current value of the connection's encoding -- which I'm strongly opposed to. We could also pass in the encoding when it's constructed, but since that can change independently of the type I'm not a huge fan of that either. This feels like a reasonable middle ground, where if we have an array of strings we simply use the encoding of the string we're given. Fixes #26326.
* Fix CI failure caused by df84e9867219e9311aef6f4efd5dd9ec675bee5cRyuta Kamizono2016-08-231-2/+2
|
* Fix `OID::Bit#cast_value`Ryuta Kamizono2016-08-201-2/+3
| | | | Fixes #26137.
* Remove unused `blob_or_text_column?` methodRyuta Kamizono2016-08-191-5/+0
|
* Remove unnecessary `test_sql_for_insert_with_returning_disabled`Ryuta Kamizono2016-08-181-6/+0
| | | | | Because `sql_for_insert` is only called in `use_insert_returning?` is true since #26002.
* Merge pull request #26074 from kamipo/where_by_attribute_with_array_or_rangeRafael França2016-08-162-0/+12
|\ | | | | `where` by `array|range` attribute with array or range value
| * `where` by `array|range` attribute with array or range valueRyuta Kamizono2016-08-112-0/+12
| | | | | | | | | | | | | | Currently predicate builder cannot build a predicate for `array|range` attribute. This commit fixes the issue. Related #25671.
* | Add three new rubocop rulesRafael Mendonça França2016-08-1613-79/+79
|/ | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix a NoMethodError schema_statements.rbGenadi Samokovarov2016-08-101-0/+6
| | | | | | | | | | | | | | | | | | If you call `remove_index` with wrong options, say a type, like I did, you get: ``` == 20160810072541 RemoveUniqueIndexOnGoals: migrating ========================= -- remove_index(:goal, {:coulmn=>:kid_id, :unique=>true}) rails aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `ArgumentError' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x007fb7dec91b28> ``` What happened is that I mistyped column (coulmn) and got a `NoMethodError`, because of a missing comma during the raise. This made Ruby think we're calling the method `ArgumentError`.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-0611-14/+11
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-0617-258/+258
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-064-19/+19
|
* modernizes hash syntax in activerecordXavier Noria2016-08-0616-73/+73
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-0661-843/+843
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* The problem isn't the detection but the deadlock itselfDavid Heinemeier Hansson2016-08-042-4/+4
|
* Merge pull request #25107 from Erol/introduce-new-ar-transaction-error-classesRafael Mendonça França2016-08-032-22/+40
|\ | | | | | | | | | | Introduce new ActiveRecord transaction error classes Closes #26018
| * Introduce new ActiveRecord transaction error classesErol Fornoles2016-05-242-22/+40
| |
* | Fix explain logging with bindsRyuta Kamizono2016-07-202-4/+4
| | | | | | | | `binds` is an array of a query attribute since Active Record 5.0.
* | Merge pull request #25307 from ↵Eileen M. Uchitelle2016-07-011-0/+21
|\ \ | | | | | | | | | | | | kamipo/extract_foreign_key_action_from_information_schema Extract foreign key action from `information_schema`
| * | Extract foreign key action from `information_schema`Ryuta Kamizono2016-06-071-0/+21
| | | | | | | | | | | | Fixes #25300.
* | | Do not specal case inspecting associated arrays of over 10 elements, ↵Kevin McPhillips2016-06-291-1/+6
|/ / | | | | | | preventing infinite looping in some cases.
* | Fix sqlite3 test failureRyuta Kamizono2016-06-042-3/+3
| | | | | | | | Sqlite3 test failure is due to 66ebbc4952f6cfb37d719f63036441ef98149418.
* | Dont re-define class SQLite3Adapter on testArthur Neves2016-06-032-108/+98
| | | | | | | | | | | | | | We were declaring in a few tests, which depending of the order load will cause an error, as the super class could change. see https://github.com/rails/rails/commit/ac1c4e141b20c1067af2c2703db6e1b463b985da#commitcomment-17731383
* | Do not include default column limit in schema.rbRyuta Kamizono2016-05-311-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of #20815. ```ruby class CreatePeople < ActiveRecord::Migration[5.0] def change create_table :people do |t| t.integer :int t.bigint :bint t.text :txt t.binary :bin end end end ``` Result. In postgresql and sqlite3 adapters: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ``` In mysql2 adapter: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt", limit: 65535 t.binary "bin", limit: 65535 end end ``` After this patch: ```ruby ActiveRecord::Schema.define(version: 20160531141018) do create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "int" t.bigint "bint" t.text "txt" t.binary "bin" end end ```
* Add AR::TransactionSerializationError for transaction serialization failures ↵Erol Fornoles2016-05-212-0/+134
| | | | or deadlocks
* Rails 5.1 point type should not raise exception if empty string is provided ↵bUg2016-05-151-0/+7
| | | | as value
* Should quote `lock_name` to pass to `get_advisory_lock`Ryuta Kamizono2016-05-101-3/+3
|
* Followup of #24835Vipul A M2016-05-032-4/+4
| | | | Fix failing tests
* Extract `add_sql_comment!` methodRyuta Kamizono2016-04-291-3/+3
| | | | | | Refactor of #22911. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>