aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/transactions_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* fix order dependent testNeeraj Singh2013-07-281-0/+5
| | | | | `ReflectionTest` uses column information in tests and those tests break if tests are run in random order.
* #4566: Remove extra decrement of transaction levelPaul Nikitochkin2013-07-141-0/+14
| | | | | | | | | | | | `rollback_active_record_state!` tries to restore model state on `Exception` by invoking `restore_transaction_record_state` it decrement deep level by `1`. After restoring it ensure that states to be cleared and level decremented by invoking `clear_transaction_record_state`, which cause the bug: because state already reduced in `restore_transaction_record_state`. Removed double derement of transaction level and removed duplicated code which clear transaction state for top level.
* close our connection when we are doneAaron Patterson2013-07-081-13/+11
|
* Remove deprecated `transaction_joinable=`Arun Agrawal2013-07-031-9/+0
| | | | | in favor of `begin_transaction` with `:joinable` option.
* remove deprecated `PostgreSQLAdapter#outside_transaction?` method.Yves Senn2013-07-031-10/+0
|
* Reduced memory leak problem in transactions by lazily updating AR objects ↵wangjohn2013-02-201-2/+2
| | | | with new transaction state. If AR object has a callback, the callback will be performed immediately (non-lazily) so the transaction still has to keep records with callbacks.
* Refactored transaction state into its own object. Each transaction creates a ↵wangjohn2013-01-211-2/+10
| | | | new transaction state object upon initialization.
* Created state for a transaction and added tests.wangjohn2013-01-201-0/+20
|
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-4/+4
|
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-311-2/+2
|
* frozen state should be restored after txn is abortedAaron Patterson2012-10-221-0/+15
|
* Get rid of global variable in AR transactions testCarlos Antonio da Silva2012-09-201-7/+7
|
* Remove our use of #outside_transaction?Jon Leighton2012-09-151-29/+3
| | | | | | | | | | | | | | | | This method was first seen in 045713ee240fff815edb5962b25d668512649478, and subsequently reimplemented in fb2325e35855d62abd2c76ce03feaa3ca7992e4f. According to @jeremy, this is okay to remove. He thinks it was added because at the time we didn't have much transaction state to keep track of, and he viewed it as a hack for us to track it internally, thinking it was better to ask the connection for the transaction state. Over the years we have added more and more state to track, a lot of which is impossible to ask the connection for. So it seems that this is just a relic of the passed and we will just track the state internally only.
* Remove the transaction_open variableJon Leighton2012-09-151-0/+5
|
* Move transaction joinability into the transaction objectJon Leighton2012-09-151-0/+9
|
* Start to tease out transaction handling into a state machineJon Leighton2012-09-151-0/+1
|
* removing dead codeAaron Patterson2012-08-201-19/+7
|
* define singleton methods rather than adding and removing methodsAaron Patterson2012-08-201-45/+32
|
* remove dead codeAaron Patterson2012-08-201-78/+36
|
* Restore state on create when ActiveRecord::RecordInvalid is raisedDave Yeu2012-08-111-0/+17
| | | | This fixes issue #3217.
* Restore the frozen state on rollback. Fixes #6417.Godfrey Chan2012-05-211-0/+10
| | | | | | | | | | | | | | | | | | | | Currently, when saving a frozen record, an exception would be thrown which causes a rollback. However, there is a bug in active record that "defrost" the record as a side effect: >> t = Topic.new => #<Topic id: nil, ...> >> t.freeze => #<Topic id: nil, ...> >> t.save RuntimeError: can't modify a frozen Hash >> t.frozen? => false >> t.save => true This patch fixes the bug by explictly restoring the frozen state on the attributes Hash after every rollback.
* Automatic closure of connections in threads is deprecated. For exampleAaron Patterson2011-11-291-0/+3
| | | | | | | | | | | | | | | | | the following code is deprecated: Thread.new { Post.find(1) }.join It should be changed to close the database connection at the end of the thread: Thread.new { Post.find(1) Post.connection.close }.join Only people who spawn threads in their application code need to worry about this change.
* 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.
* persisted? should be able to return a truthy objectAaron Patterson2010-12-161-8/+8
|
* removing many unused variablesAaron Patterson2010-11-161-1/+1
|
* use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-8/+8
| | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Fix SQLite adapter name [#5842 state:resolved]Anil Wadghule2010-10-191-1/+1
|
* #transaction on the instance level should take options as wellCarl Lerche2010-10-141-0/+21
|
* Update the ActiveRecord tests to not set unused optionsCarl Lerche2010-10-131-2/+0
| | | This makes a test fail, but it is revealing a bug in Arel master.
* update_attributes and update_attributes! are now wrapped in a transactionNeeraj Singh2010-07-131-1/+22
| | | | | | [#922 state:resovled] Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Temporarily revert "Update after_commit and after_rollback docs and ↵Jeremy Kemper2010-06-081-0/+33
| | | | | | | | tests to use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction."" This reverts commit 1b2941cba1165b0721f57524645fe378bee2a950. [#2991]
* Temporarily revert "Update after_commit and after_rollback docs and tests to ↵Jeremy Kemper2010-06-081-33/+0
| | | | | | | | | | | | | | use new style API with an :on options instead of on_* suffix." and "Add after_commit and after_rollback callbacks to ActiveRecord that are called after transactions either commit or rollback on all records saved or destroyed in the transaction." This reverts commits d2a49e4b1f30c5997e169110eed94a55aee53f56 and da840d13da865331297d5287391231b1ed39721b. [#2991] Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/transactions.rb activerecord/test/cases/transaction_callbacks_test.rb
* Add after_commit and after_rollback callbacks to ActiveRecord that are ↵Brian Durand2010-04-291-14/+47
| | | | | | | | called after transactions either commit or rollback on all records saved or destroyed in the transaction. [#2991 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* squelching more warnings in the AR tests. [#4218 state:resolved]Aaron Patterson2010-03-181-6/+32
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Refactor new callbacks and AR implementation.José Valim2009-09-081-6/+6
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-5/+5
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* SQLite adapters now support DDL transactions [#2080 state:resolved]Jason King2009-03-141-5/+10
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-2/+2
| | | | [#1617 state:resolved]
* Revert "Wrap calls to update_attributes in a transaction."Michael Koziarski2009-02-221-34/+0
| | | | | | | This caused failures on sqlite, sqlite3 and postgresql This reverts commit fc09ebc669bd58f415f7d3ef932ef02dab821ab5. [#922 state:reopened]
* Wrap calls to update_attributes in a transaction.Xavier Noria2009-02-221-0/+34
| | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#922 state:committed]
* Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha.Jeremy Kemper2009-02-031-18/+14
|
* Fix PostgreSQL unit test failures that only occur when using the old ↵Hongli Lai (Phusion)2009-01-131-2/+1
| | | | | | | | 'postgres' driver. [#1748 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Introduce transaction_joinable flag to mark that the fixtures transaction ↵Jeremy Kemper2009-01-101-4/+4
| | | | | | can't joined, a new savepoint is required even if :requires_new is not set. Use :requires_new option instead of :nest. Update changelog. [#383 state:committed]
* Reimplement Jeremy's PostgreSQL automatic transaction state introspection code.Hongli Lai (Phusion)2008-11-031-0/+34
| | | | | | - Fixed compatibility with the old 'postgres' driver which doesn't support transaction state introspection. - Added unit tests for it.
* Rename ActiveRecord::Base#transaction's :force option to :nest. Improve ↵Hongli Lai (Phusion)2008-11-031-5/+5
| | | | documentation for nested transactions.
* Make SQLite3 pass the unit tests for savepoints.Hongli Lai (Phusion)2008-11-031-4/+4
|
* Fix a stale typo in the PostgreSQL adapter. Fix a stale mock expection in ↵Hongli Lai (Phusion)2008-11-031-1/+0
| | | | transaction_test.
* Implement savepoints.Jonathan Viney2008-11-031-0/+132
|
* Default connection allow_concurrency to false (for PostgreSQL)Nick Sieger2008-09-041-0/+2
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>