aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Don't test PostgreSQL implementation detailsAkira Matsuda & Kohei Suzuki2014-08-291-3/+0
| | | | | | | | | | | | | | | | | | | | Asserting that the message contains "QUERY PLAN" is enough for the adapter's test. The plan may vary according to number of tuples etc. but that's out of our concern.
* | | | Revert "Merge pull request #16254 from ↵Yves Senn2014-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zuhao/refactor_activerecord_attribute_decorators_test" This reverts commit 16fe19831548f108c113094d106663497fc190d5, reversing changes made to 4c81c8ce533896be28bdc0b055ff30bb9dee1316. The call to `Model.reset_column_information` was to express the intent of the test. `reset_column_information` itself can trigger SQL queries because it checks for a tables existance. Let's move it outside of the block. /cc @sgrif
* | | | Reset ActiveRecord::Migration.message_count counter before start testingAkira Matsuda2014-08-291-1/+1
| | | |
* | | | Bring original puts back after finishing testsAkira Matsuda2014-08-292-4/+12
| | | |
* | | | Silence another test that runs migrationsAkira Matsuda2014-08-291-0/+5
| | | |
* | | | MigrationTest doesn't need to be verbose anymoreAkira Matsuda2014-08-291-1/+1
| | | |
* | | | No tests are dealing with ActiveRecord::Migration.message_count here anymoreAkira Matsuda2014-08-291-1/+0
| | | |
* | | | Reset ActiveRecord::Migration.verbose to the value beforeAkira Matsuda2014-08-292-2/+5
| | | |
* | | | Demodulize ActiveRecord::MigratorTestAkira Matsuda2014-08-291-284/+282
| | | |
* | | | No transaction for a test that creates fixtures in the test bodyAkira Matsuda2014-08-291-0/+1
| | | |
* | | | User Model#last to certainly get lastly created dataAkira Matsuda2014-08-281-1/+1
| | | | | | | | | | | | | | | | This test would fail when executed after any test that calls fixtures(:binaries)
* | | | Move association definition to the model fileAkira Matsuda2014-08-282-2/+1
| | | |
* | | | Be sure that test fixtures satisfy referential integrity before calculatingAkira Matsuda2014-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There exists some other test files that load :minivans fixtures but don't load :speedometers. Loading :speedometers here prevents the following error when this test was run after such test: CalculationsTest#test_should_group_by_association_with_non_numeric_foreign_key: ActiveRecord::RecordNotFound: Couldn't find all Speedometers with 'speedometer_id': (ABC, s1) (found 1 results, but was looking for 2)
* | | | Ignore SCHEMA queries when asserting no queriesAkira Matsuda2014-08-285-22/+22
| | | |
* | | | Reset schema properly after schema changing testAkira Matsuda2014-08-281-0/+2
| | | |
* | | | Correctly detect mutation on serialized columns mapping to binarySean Griffin2014-08-271-0/+16
| | | | | | | | | | | | | | | | Fixes #16701
* | | | Override #find_by! in core to enable AST cachingGodfrey Chan2014-08-251-0/+22
| | | |
* | | | Fixed find_by("sql fragment without bindings") on masterGodfrey Chan2014-08-253-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Also duplicated find_by tests from relations_test.rb to finder_test.rb now that we have a completely different implementation on the class (in core.rb with AST caching stuff). * Also removed a (failing) test that used mocks. Now that we have tests for the behavior, there's no point having another test that tests the implementation (that it delegates). Further, what the test was implying is nolonger true with the current implementation, because Class.find_by is a real method now.
* | | | pg, `default_sequence_name` needs to return a string.Yves Senn2014-08-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reacon to https://github.com/rails/rails/commit/d6c1205584b1ba597db4071b168681678b1e9875#commitcomment-7502487 This backwards incompatibility was introduced with d6c12055 to fix #7516. However both `connection.default_sequence_name` and `model.sequence_name` are public API. The PostgreSQL adapter should honor the interface and return strings. /cc @matthewd @chancancode
* | | | Don't trim excess whitespace in pg #columns_for_distinctAgis-2014-08-241-0/+8
| | | | | | | | | | | | | | | | Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
* | | | adding the exception RecordNotFound to UUID findJoseLuis Torres2014-08-212-1/+15
| |/ / |/| |
* | | "warning: assigned but unused variable"Akira Matsuda2014-08-211-1/+1
| | |
* | | Merge pull request #16172 from Agis-/hmt_scope_arityRafael Mendonça França2014-08-204-0/+17
|\ \ \ | | | | | | | | has_many :through with dynamic condition merging
| * | | Only merge scopes with zero arity in has_many throughAgis-2014-08-204-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with dynamic conditions. Fixes #16128 This bug was introduced in https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d so it's present from 4.1.2-rc1 and after. https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d merges any relation scopes passed as proc objects to the relation, but does *not* take into account the arity of the lambda. To reproduce: https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
* | | | Merge pull request #16145 from phoet/patch-2Rafael Mendonça França2014-08-201-5/+10
|\ \ \ \ | | | | | | | | | | don't log errors when all is fine
| * | | | don't log errors when all is finePeter Schröder2014-07-171-5/+10
| | | | |
* | | | | Ignore Postgresql "SELECT tablename FROM pg_tables" when counting queriesAkira Matsuda2014-08-201-1/+1
| | | | |
* | | | | Drop schema_migrations table only when existsAkira Matsuda2014-08-201-1/+1
| |/ / / |/| | |
* | | | Merge pull request #16349 from jmcnevin/masterRafael Mendonça França2014-08-191-0/+15
|\ \ \ \ | | | | | | | | | | Correctly determine if migration is needed.
| * | | | Correctly determine if migration is needed.Jeremy McNevin2014-08-131-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method would assume that if last migration in the migrations directory matched the current schema version, that the database was up to date, but this does not account for new migrations with older timestamps that may be pending.
* | | | | Fixes the `Relation#exists?` to work with polymorphic associations.Kassio Borges2014-08-182-0/+15
| | | | | | | | | | | | | | | | | | | | Fixes #15821.
* | | | | Merge pull request #16537 from arthurnn/stop_swallowing_errors_2Godfrey Chan2014-08-182-0/+79
|\ \ \ \ \ | | | | | | | | | | | | Add option to stop swallowing errors on callbacks.
| * | | | | Add option to stop swallowing errors on callbacks.Arthur Neves2014-08-182-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Active Record will rescue any errors raised within after_rollback/after_create callbacks and print them to the logs. Next versions of rails will not rescue those errors anymore, and just bubble them up, as the other callbacks. This adds a opt-in flag to enable that behaviour, of not rescuing the errors. Example: # For not swallow errors in after_commit/after_rollback config.active_record.errors_in_transactional_callbacks = true [fixes #13460]
* | | | | | Check attributes passed to create_with and whereRafael Mendonça França2014-08-181-0/+30
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the request parameters are passed to create_with and where they can be used to do mass assignment when used in combination with Relation#create. Fixes CVE-2014-3514 Conflicts: activerecord/lib/active_record/relation/query_methods.rb
* | | | | Merge pull request #16528 from ↵Santiago Pastorino2014-08-181-0/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | byroot/add-test-case-for-nested-array-in-where-conditions Add a test case of nested empty array values in conditions
| * | | | | Add a test case of nested empty array values in conditionsJean Boussier2014-08-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Post.where(id: [[]]).to_a Used to fail with a SQL syntax error (until 4.1): SELECT ... WHERE id in (); It now properly generate: SELECT ... WHERE 1=0;
* | | | | | Merge pull request #16481 from sgrif/sg-change-default-timestampsDavid Heinemeier Hansson2014-08-179-17/+77
|\ \ \ \ \ \ | | | | | | | | | | | | | | Change the default `null` value for timestamps
| * | | | | | Change the default `null` value for timestampsSean Griffin2014-08-129-17/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per discussion, this changes the model generators to specify `null: false` for timestamp columns. A warning is now emitted if `timestamps` is called without a `null` option specified, so we can safely change the behavior when no option is specified in Rails 5.
* | | | | | | Merge pull request #16458 from chancancode/ar_fix_reserved_inheritanceGodfrey Chan2014-08-171-0/+18
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue w/custom accessors + reserved name + inheritance Conflicts: activerecord/CHANGELOG.md
| * | | | | | Fixed issue w/custom accessors + reserved name + inheritanceGodfrey Chan2014-08-111-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed an issue where custom accessor methods (such as those generated by `enum`) with the same name as a global method are incorrectly overridden when subclassing. This was partially fixed in 4155431 then broken again by e5f15a8. Fixes #16288.
* | | | | | | Implement `_was` and `changes` for in-place mutations of AR attributesSean Griffin2014-08-161-0/+21
| | | | | | |
* | | | | | | Merge pull request #16517 from sgrif/sg-comparable-attributesRafael Mendonça França2014-08-162-0/+36
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Implement `==` on `Type::Value` and `Attribute`
| * | | | | | | Implement `==` on `Type::Value` and `Attribute`Sean Griffin2014-08-152-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a small self contained piece of the refactoring that I am working on, which required these objects to be comparable.
* | | | | | | | Fix regression on after_commit in nested transactions.Arthur Neves2014-08-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after_commit should not run in nested transactions, however they should run once the outermost transaction gets committed. This patch fixes the problem copying the records from the Savepoint to its parent. So the RealTransaction will have all records that needs to run callbacks on it. [fixes #16425]
* | | | | | | | Use *_transaction methods in TransactionManagerArthur Neves2014-08-151-0/+24
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use `commit_transaction`/`rollback_transaction` on `within_new_transaction` method, so they make sure they `pop` the transaction from the stack before calling the methods `commit`/`rollback`.
* | | | | | | fix typo in method name (broken build :sweat:)Yves Senn2014-08-151-1/+1
| | | | | | |
* | | | | | | prefer `has_attribute?` over `attributes.key?`.Yves Senn2014-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to the discussion on #16505.
* | | | | | | create_table + transactional_fixtures = :bomb:Akira Matsuda2014-08-151-0/+4
| | | | | | |
* | | | | | | Ignore MySQL "SHOW VARIABLES" when counting queriesAkira Matsuda2014-08-151-1/+1
| | | | | | |
* | | | | | | Be sure to reset PK name renamed in the testAkira Matsuda2014-08-151-0/+3
| | | | | | |