aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #21607 from kamipo/remove_unnecessary_display_widthJeremy Daer2015-09-192-5/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove unnecessary display width
| * | | | | | Remove unnecessary display widthRyuta Kamizono2015-09-162-5/+5
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The **(11)** does not affect the storage size of the data type, which for an INT will always be 4 bytes. It affects the **display width**. http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html
* | | | | | Merge pull request #21681 from kamipo/should_test_both_mysql_adaptersJeremy Daer2015-09-194-22/+18
|\ \ \ \ \ \ | | | | | | | | | | | | | | Should test both mysql adapters
| * | | | | | Should test both mysql adaptersRyuta Kamizono2015-09-204-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some test cases are testing only mysql adapter. We should test mysql2 adapter also.
* | | | | | | Merge pull request #21614 from kamipo/correctly_dump_composite_primary_keyJeremy Daer (Kemper)2015-09-192-1/+28
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Correctly dump composite primary key
| * | | | | | Correctly dump composite primary keyRyuta Kamizono2015-09-202-1/+28
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :barcodes, primary_key: ["region", "code"] do |t| t.string :region t.integer :code end
* / | | | | Remove `@connection` in `StatementPool`Ryuta Kamizono2015-09-202-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | `@connection` in `StatementPool` is only used for PG adapter. No need for abstract `StatementPool` class.
* | | | | File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-183-4/+0
| | | | |
* | | | | Merge pull request #21581 from ronakjangir47/restrict_with_errorYves Senn2015-09-172-0/+37
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | `restrict_with_error` message will now respect owner’s human name
| * | | | | `restrict_with_error` message will now respect owner’s human name in any ↵Ronak Jangir2015-09-122-0/+37
| |/ / / / | | | | | | | | | | | | | | | locale [kuboon & Ronak Jangir]
* / / / / Removed mocha from Active Record Part 2Ronak Jangir2015-09-168-58/+85
|/ / / /
* | | | remove dead code.Yves Senn2015-09-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | The last call site of `last_version` was removed with: 838e18321118ee3ec6669217e5ea0216f79c969a
* | | | Merge pull request #21486 from bogdan/refactor-has-many-counter-cacheEileen M. Uchitelle2015-09-091-1/+1
|\ \ \ \ | | | | | | | | | | HasManyAssociation: moved half of counter cache code to reflection
| * | | | HasManyAssociation: moved half of counter cache code to reflectionBogdan Gusiev2015-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation has a lot of utility methods that accept reflection call a lot of methods on it and exit. E.g. has_counter_cache?(reflection) It causes confusion and inability to cache result of the method even through it always returns the same result for the same reflection object. It can be done easier without access to the association context by moving code into reflection itself. e.g. reflection.has_counter_cache? Reflection is less complex object than association so moving code there automatically makes it simplier to understand.
* | | | | Revert "Merge pull request #20080 from ↵Rafael Mendonça França2015-09-091-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | robertjlooby/fix_overwriting_by_dynamic_finders" This reverts commit d5ba9a42a6e93b163a49f99d739aa56820e044d0, reversing changes made to 30c503395bf6bf7db1ec0295bd661ce644628db5. Reason: This generate the dynalic finders more than one time
* | | | | Merge pull request #20080 from robertjlooby/fix_overwriting_by_dynamic_findersRafael Mendonça França2015-09-091-0/+13
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | put dynamic matchers on GeneratedAssociationMethods instead of model
| * | | | | put dynamic matchers on the GeneratedAssociationMethods instead of modelRob Looby2015-05-081-0/+13
| | | | | |
* | | | | | Merge pull request #20921 from pboling/fix-sql-colors-in-log-subscriberRafael Mendonça França2015-09-091-0/+98
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Fix and Improve sql logging coloration in `ActiveRecord::LogSubscriber`.
| * | | | | | Improve sql logging coloration in `ActiveRecord::LogSubscriber`.Peter Boling2015-07-171-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Improves coloring for statements like: # Become WHITE SELECT * FROM ( SELECT * FROM mytable FOR UPDATE ) ss WHERE col1 = 5; LOCK TABLE table_name IN ACCESS EXCLUSIVE MODE; # Becomes RED ROLLBACK - Reinstates the coloration of the `payload[:name]`. Instead of simple alternating colors, adds meaning: - `MAGENTA` for `"SQL"` or `blank?` payload names - `CYAN` for Model Load/Exists - Introduces specs for sql coloration. - Introduces specs for payload name coloration. GH#20885
* | | | | | | Merge pull request #21535 from dmitry/feature/validate-multiple-contextsRafael Mendonça França2015-09-081-0/+7
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Validate multiple contexts on `valid?` and `invalid?` at once
| * | | | | | Validate multiple contexts on `valid?` and `invalid?` at once.Dmitry Polushkin2015-09-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: ```ruby class Person include ActiveModel::Validations attr_reader :name, :title validates_presence_of :name, on: :create validates_presence_of :title, on: :update end person = Person.new person.valid?([:create, :update]) # => true person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]} ```
* | | | | | | Merge pull request #21511 from rwz/ar-exceptions-no-argsEileen M. Uchitelle2015-09-081-0/+16
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Removes mandatory arguments from AR exceptions
| * | | | | | | Make ActiveRecordException descendants args optionalPavel Pravosud2015-09-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows to instantiate all ActiveRecordError descendant execption classes without arguments, which might be useful in testing and is far less surprising than mandatory arguments.
* | | | | | | | Merge pull request #21528 from yui-knk/test/add_tests_for_mysql2_viewYves Senn2015-09-082-64/+66
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | Add tests for test/cases/adapters/mysql2/view_test.rb
| * | | | | | | Add view tests for MySQLyui-knk2015-09-082-64/+66
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically view tests for MySQL are same with `test/cases/adapters/postgresql/view_test.rb`. So move `test/cases/adapters/postgresql/view_test.rb` to `test/cases/view_test.rb` and make them only run if `current_adapter` supports writable view.
* | | | | | | Revert "Merge pull request #21069 from ↵Rafael Mendonça França2015-09-071-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dmitry/feature/validate-multiple-contexts-at-once" This reverts commit 51dd2588433457960cca592d5b5dac6e0537feac, reversing changes made to ecb4e4b21b3222b823fa24d4a0598b1f2f63ecfb. This broke Active Record tests
* | | | | | | Merge pull request #21069 from dmitry/feature/validate-multiple-contexts-at-onceRafael Mendonça França2015-09-071-0/+7
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Validate multiple contexts on `valid?` and `invalid?` at once
| * | | | | | | Validate multiple contexts on `valid?` and `invalid?` at once.Dmitry Polushkin2015-07-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: ```ruby class Person include ActiveModel::Validations attr_reader :name, :title validates_presence_of :name, on: :create validates_presence_of :title, on: :update end person = Person.new person.valid?([:create, :update]) # => true person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]} ```
* | | | | | | | Allow global migrations_path configuration with using value from ↵Tobias Bielohlawek2015-09-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | database_tasks instead of Migrator
* | | | | | | | Fix test failures from premature merge of #21317Matthew Draper2015-09-071-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently I managed to forget how similar the "tests passing" and "no status reported" merge indicators look. Note that the previous `stubs` in test_add_index wasn't working: the method was still called, and just happened to return false.
* | | | | | | | Merge pull request #21317 from ↵Matthew Draper2015-09-072-2/+11
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | greysteil/support-postgres-drop-index-concurrently Support dropping indexes concurrently in Postgres
| * | | | | | | | Support dropping indexes concurrently in PostgresGrey Baker2015-09-052-2/+11
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more details.
* / | | | | | | Deprecate passing conditions to AR::Relation destroy_all and delete_all methodsWojciech Wnętrzak2015-09-062-1/+13
|/ / / / / / /
* | | | / / / Remove unnecessary require in associations_test.rbakihiro172015-09-031-1/+0
| |_|_|/ / / |/| | | | |
* | | | | | Respect scale of the column in the Decimal typeRafael Mendonça França2015-09-012-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | [Rafael Mendonça França + Jean Boussier]
* | | | | | Make revert of `disable_extension` to workyui-knk2015-08-301-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is fix of #11826 which miss to add `disable_extension` to `ReversibleAndIrreversibleMethods`. So `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called.
* | | | | | pg, `create_schema`, `drop_schema` and `rename_table` quote schema name.Yves Senn2015-08-281-7/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #21418. Previously schema names were not quoted. This leads to issues when a schema names contains a ".". Methods in `schema_statements.rb` should quote user input.
* | | | | | PostgreSQL, add `:if_exists` to `#drop_schema`.Yves Senn2015-08-282-11/+22
| | | | | |
* | | | | | no more require minitest mockGaurav Sharma2015-08-273-3/+0
| | | | | |
* | | | | | Merge pull request #21386 from ronakjangir47/remove_dupsRafael Mendonça França2015-08-264-4/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Removed duplicate requires
| * | | | | | Removed duplicate require ‘models/computer’Ronak Jangir2015-08-264-4/+0
| | | | | | |
* | | | | | | Fix the unused variable warningakihiro172015-08-261-1/+0
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following warning. ```ruby warning: assigned but unused variable - index_definition ```
* | | | | | Merge pull request #21377 from ronakjangir47/remove_mocha_active_recordKasper Timm Hansen2015-08-2512-119/+153
|\ \ \ \ \ \ | | | | | | | | | | | | | | Removed mocha from Active Record Part 1
| * | | | | | Removed mocha from Active Record Part 1Ronak Jangir2015-08-2512-119/+153
| | | | | | |
* | | | | | | Make `change_column_default` to workyui-knk2015-08-251-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is fix of #20018 which removes `change_column_default` from array, so `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called. This PR * fix this bug * define `ReversibleAndIrreversibleMethods` const making clear which this array means to prevent these miss
* | | | | | | Merge pull request #21342 from yui-knk/test/add_assert_methodRafael Mendonça França2015-08-241-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Add `assert_nothing_raised` to make clear test case perpose
| * | | | | | | Add `assert_nothing_raised` to make clear test case perposeyui-knk2015-08-231-1/+1
| | | | | | | |
* | | | | | | | Further fix failing tests caused by #21350Sean Griffin2015-08-241-0/+1
| | | | | | | |
* | | | | | | | Fix failing tests caused by #21350Sean Griffin2015-08-241-0/+1
| |/ / / / / / |/| | | | | |
* | | | | | | Only nullify persisted has_one target associationsAgis-2015-08-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since after 87d1aba3c `dependent: :destroy` callbacks on has_one assocations run *after* destroy, it is possible that a nullification is attempted on an already destroyed target: class Car < ActiveRecord::Base has_one :engine, dependent: :nullify end class Engine < ActiveRecord::Base belongs_to :car, dependent: :destroy end > car = Car.create! > engine = Engine.create!(car: car) > engine.destroy! # => ActiveRecord::ActiveRecordError: cannot update a > destroyed record In the above case, `engine.destroy!` deletes `engine` and *then* triggers the deletion of `car`, which in turn triggers a nullification of `engine.car_id`. However, `engine` is already destroyed at that point. Fixes #21223.