Commit Graph

51 Commits

Author SHA1 Message Date
Yves Senn
85261a5e96 remove ancient TODOs [ci skip]. 2013-03-18 16:42:08 +01:00
Amparo Luna + Guillermo Iguaran
1f3a1fedf9 Rename update_attributes method to update, keep update_attributes as an alias 2013-01-03 11:51:21 -05:00
Rafael Mendonça França
f89d5e4603 Use a model without counter cache to test read-only attributes 2012-08-21 15:47:02 -03:00
Andrey Deryabin
3aec521c25 removed deprecation warnings 2012-04-28 10:55:11 +07:00
Jon Leighton
75f03eca75 remove calls to find(:first), find(:last) and find(:all) 2012-04-26 18:32:55 +01:00
Jon Leighton
40a711ce29 remove tests for #with_scope (it's now deprecated) 2012-04-25 17:52:28 +01:00
Jon Leighton
43f9622c67 fix test 2012-03-30 14:37:37 +01:00
Jon Leighton
bd40e5c9e4 whitespace ✂️ 2012-03-30 14:36:33 +01:00
Nick Rogers
2931f413a5 Tests for removing a HABTM association when optimistic locking is enabled. 2012-03-07 23:56:23 -05:00
Olek Janiszewski
7afbc89c37 Add ActiveRecord::Base#with_lock
Add a `with_lock` method to ActiveRecord objects, which starts
a transaction, locks the object (pessimistically) and yields to the block.
The method takes one (optional) parameter and passes it to `lock!`.

Before:

    class Order < ActiveRecord::Base
      def cancel!
        transaction do
          lock!
          # ... cancelling logic
        end
      end
    end

After:

    class Order < ActiveRecord::Base
      def cancel!
        with_lock do
          # ... cancelling logic
        end
      end
    end
2012-01-18 23:23:41 +01:00
Karunakar (Ruby)
ca0718c164 removed unnecessary +1 from assert_difference because default difference is 1 2012-01-05 00:03:30 +05:30
Karunakar (Ruby)
9a5b335d36 refactored tests -- assert_diffrence instead of checking directly with count 2012-01-04 20:41:07 +05:30
Dmitry Polushkin
04bc40ff50 Merge branch 'master' of git://github.com/rails/rails 2011-12-31 01:10:42 +00:00
Sergey Nartimov
9add7608f1 remove deprecated set and original methods for table_name, primary_key, etc 2011-12-21 22:00:55 +03:00
Arun Agrawal
de78c7e8e4 Removed test which works only < 1.9 2011-12-21 15:35:57 +05:30
Jon Leighton
47b97a739d Fix up test altering global state that was causing me grief 2011-12-01 23:41:51 +00:00
Jon Leighton
8df787d428 Deprecated define_attr_method in ActiveModel::AttributeMethods
This only existed to support methods like `set_table_name` in Active
Record, which are themselves being deprecated.
2011-11-29 20:13:37 +00:00
Jon Leighton
f3c84dc316 Deprecate set_locking_column in favour of self.locking_column= 2011-11-29 20:13:37 +00:00
Jon Leighton
0b72a04d0c Deprecate set_table_name in favour of self.table_name= or defining your own method. 2011-11-29 20:13:36 +00:00
Christian Bäuerlein
410fa4cf7c Includes stale record in StaleObjectError 2011-10-14 16:28:02 +02:00
Dmitry Polushkin
edd2f21e80 Test polymorphic record with optimistic locking and counter cache should be destoyed without catching the ActiveRecord::StaleObjectError. 2011-09-09 08:31:54 +01:00
Aaron Patterson
61774e0d49 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
Jon Leighton
253bb6b926 Refactor Active Record test connection setup. Please see the 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. 2011-06-04 23:47:03 +01:00
Christopher Meiklejohn
4fbd8adf48 Don't quote ID's as Arel will quote them -- follow same conventions as the delete method. 2011-05-08 18:37:28 +01:00
Franck Verrot
8bc464c809 The optimistic lock column should be increased when calling touch
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:27:40 -02:00
Aaron Patterson
cd440236ad this test requires the job model, so we should require it 2011-02-08 11:31:46 -08:00
Aaron Patterson
e6881217ed fixing bug where 1.8 hangs while running pg tests 2011-01-18 10:49:50 -08:00
Jon Leighton
4e19ec566c In a number of places in the tests, we only need to turn off transactional fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :) 2011-01-11 13:45:07 -08:00
Jon Leighton
80df74bf51 Enable the sqlite3 in-memory test connection to work 2011-01-11 13:45:06 -08:00
raggi
d8692985fe Don't depend on rubygems loading thread (for Mutex) 2010-11-25 06:47:27 +08:00
Aaron Patterson
676a00163d clear any stale connections before messing with threaded tests 2010-10-13 16:58:03 -07:00
Carl Lerche
91ba75806f Update the ActiveRecord tests to not set unused options
This makes a test fail, but it is revealing a bug in Arel master.
2010-10-13 12:32:52 -07:00
Jacob Lewallen
d10ecfefb8 Set destroyed=true in opt locking's destroy [#5058 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-14 08:02:17 +02:00
wycats
d916c62cfc eliminate alias_method_chain from ActiveRecord 2010-05-09 02:37:52 +03:00
Curtis Hawthorne
7e06494e32 Destroy respects optimistic locking.
Now works with :dependent => :destroy and includes unit tests for that
case.  Also includes better error messages when updating/deleting stale
objects.

[#1966 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-27 21:53:51 -07:00
Jeremy Kemper
949c8c0d0e Don't publicize with_scope for tests since it may shadow public misuse 2009-12-28 14:07:23 -08:00
Jeremy Kemper
fb61fbd352 Revert "Ensure Model#destroy respects optimistic locking"
[#1966 state:open]

This reverts commit 0d922885fb54c19f04680482f024452859218910.

Conflicts:

	activerecord/lib/active_record/locking/optimistic.rb
2009-11-17 15:35:35 -08:00
Jeremy Kemper
7601d482bd Ruby 1.9: skip pg locking test for 1.9.1 also 2009-11-15 10:28:58 -08:00
Jeremy Kemper
f0f4dffd3b Skip pg locking test due to connection checkout deadlock detection 2009-11-14 01:22:36 -08:00
Curtis Hawthorne
0d922885fb Ensure Model#destroy respects optimistic locking [#1966 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-09 14:56:09 +00:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Ken Collins
8e4624be9e Remove SQL Server cases from tests for latest adapter work to pass rails expected behavior.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-19 18:00:56 +01:00
Nick Sieger
a3f12f575d Default connection allow_concurrency to false (for PostgreSQL)
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-04 15:44:05 +02:00
Nick Sieger
d07a6b1a4a Make clear_active_connections! also return stale connections back to the pool
- also clean up some cruft remaining from per-thread connection cache
2008-08-29 14:12:12 -05:00
Nick Sieger
212134dce1 Remove CachedConnectionPerThread per-thread pooling mechanism in favor of a fixed pool with default maximum of 5 connections 2008-08-29 14:12:12 -05:00
Nick Sieger
ca6d71753f Deprecate allow_concurrency and make it have no effect 2008-08-29 14:12:12 -05:00
Daniel Morrison
3610997ba3 Partial updates don't update lock_version if nothing changed. [#426 state:resolved] 2008-06-22 20:33:43 -07:00
David Heinemeier Hansson
c353794dff Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67 state:resolved] 2008-04-30 15:04:08 -05:00
Jeremy Kemper
39814fcce0 Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00
Jeremy Kemper
1e70928014 Fix paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:31:37 +00:00