aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* fix `reset_counters` to work even with complex class namesMislav Marohnić2010-06-031-0/+25
| | | | | | e.g. it guesses that a belongs_to association to Namespace::MyModel is named "my_model", unlike before where it would look up an association named "namespace::mymodel" and fail.
* move counter_cache tests to a separate file and refactorMislav Marohnić2010-06-032-49/+58
|
* Refactor calculation test to remove unneeded SQLite special case.Santiago Pastorino2010-05-241-4/+1
| | | | | | [#4633] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix failing test.José Valim2010-05-212-9/+9
|
* Replace assert with assert_equal in some test casesNeeraj Singh2010-05-211-2/+2
| | | | | | [#4654 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Final iteration of use better testing methodsNeeraj Singh2010-05-199-25/+25
| | | | | | [#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Fixes a test on transaction_callbacks_test.rbSantiago Pastorino2010-05-191-2/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Use better assertion methods for testingNeeraj Singh2010-05-1916-89/+82
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Don't carry default value when changing column for a binary type on ↵Jeremy Kemper2010-05-181-12/+0
| | | | | | | | | | | | | | MySQL" Broke mysql tests. This reverts commit edec1afe25014749f0e2df86d27477b45586a9e3. Conflicts: activerecord/test/cases/migration_test.rb [#3234 state:open]
* make add_index and remove_index more resilient; new rename_index method; ↵Étienne Barrié2010-05-183-2/+41
| | | | | | | | track database limits [#3452 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fixes transaction callbacks testsSantiago Pastorino2010-05-181-23/+19
| | | | | | [#4640 state:committed] Signed-off-by: wycats <wycats@gmail.com>
* Nested records (re: autosave) are now updated even when the intermediate ↵Ian White2010-05-183-1/+84
| | | | | | parent record is unchanged [#4242 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* assert_equal should be used instead of assertNeeraj Singh2010-05-181-1/+1
| | | | | | [#4629 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* expected value should come first in assert_equalNeeraj Singh2010-05-181-3/+3
| | | | | | [#4630 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove Model.clear_default_scopePratik Naik2010-05-181-12/+0
|
* Use assert_equal correctly in transaction callback tests (exposing some of ↵Paco Guzman2010-05-171-17/+17
| | | | | | | | them as broken) [#4612] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* AR::Base#clone fixed to set dirty bits for cloned objectpleax2010-05-161-0/+50
| | | | | | [#2919 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* a cloned object no longer mimics changed flags from creator , plus a test ↵Federico Brubacher2010-05-161-0/+9
| | | | | | case [#4614 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Change on Array extension from rand => random_element [#4555 state:committed]Santiago Pastorino2010-05-162-8/+8
| | | | Signed-off-by: Xavier Noria <fxn@hashref.com>
* prevent to run fixture accessor (e.g. test_foos for TestFoo model) as a test ↵Nobuhiro IMAI2010-05-161-0/+5
| | | | | | | case [#2992 state:resolved] Signed-off-by: Wijnand Wiersma <wijnand@videre.net> Signed-off-by: José Valim <jose.valim@gmail.com>
* Make use of assert_equal to test equallity between object assert expects and ↵Santiago Pastorino2010-05-163-5/+5
| | | | | | | | object and a message of error [#4611 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Postgresql doesn't allow to change a string type column to a binary type. ↵Wijnand Wiersma2010-05-161-7/+9
| | | | | | Skip this test for postgresql for now. [#4616 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Don't carry default value when changing column for a binary type on MySQL ↵Elomar França2010-05-161-0/+10
| | | | | | [#3234 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an ↵José Valim2010-05-152-10/+10
| | | | | | | | options hash and make various Validators pass their (filtered) options." Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object. This reverts commit bc1c8d58ec45593acba614d1d0fecb49adef08ff.
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-05-152-10/+10
| | | | | | | | | | | | | | | | | | | | hash and make various Validators pass their (filtered) options. This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format". Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation. Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options). Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again [#4057 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Reset quoted_table_name after set_table_name [#4568 state:resolved]Santiago Pastorino2010-05-151-0/+12
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix for get_ids when including a belongs_to association on a has_many ↵Diego Algorta2010-05-152-0/+5
| | | | | | association [#2896 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* STI should not ignore type condition while applying scopes from parent class ↵Neeraj Singh2010-05-151-0/+5
| | | | | | | | scopes [#4507 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Modified default_scope to merge with any pre-existing default_scopeDavid Chelimsky + Brian Tatnall2010-05-151-2/+29
| | | | | | | | | | | | and added AR::Base::clear_default_scope - clear_default_scope provides users who rely on the old behaviour of each call to default_scope overwriting any previous default scopes an opportunity to maintain that behaviour. [#4583 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* type_cast_calculated_value refactor: value is never a Fixnum here. Fix test ↵Santiago Pastorino2010-05-111-2/+1
| | | | | | | | since SQLite returns Float. [#4514 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Remove undocumented save_without_validation!Pratik Naik2010-05-111-6/+0
|
* Make sure valid? preceives the context as in ActiveModel API (ht: Carlos ↵José Valim2010-05-102-0/+22
| | | | Antonio)
* Revert "Revert "Add index length support for MySQL [#1852 state:open]""Pratik Naik2010-05-092-0/+25
| | | | This reverts commit 6626833db13a69786f9f6cd56b9f53c4017c3e39.
* corrected AR find_each and find_in_batches to raise when the user uses ↵Josh Kalderimis2010-05-091-0/+14
| | | | | | select but does not specify the primary key Signed-off-by: José Valim <jose.valim@gmail.com>
* eliminate alias_method_chain from ActiveRecordwycats2010-05-091-3/+6
|
* updated AR to work with the AMo model validation changesJosh Kalderimis2010-05-081-1/+1
|
* Revert "Add index length support for MySQL [#1852 state:open]"José Valim2010-05-082-25/+0
| | | | | | | | | | | | | This commit breaks dumping a few tables, as the sessions table. To reproduce, just create a new application and: rake db:sessions:create rake db:migrate rake db:test:prepare And then look at the db/schema.rb file (ht: Sam Ruby). This reverts commit 5b95730edc33ee97f53da26a3868eb983305a771.
* Add index length support for MySQL [#1852 state:resolved]Emili Parreno2010-05-082-0/+25
| | | | | | | | | | | | Example: add_index(:accounts, :name, :name => 'by_name', :length => 10) => CREATE INDEX by_name ON accounts(name(10)) add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :length => {:name => 10, :surname => 15}) => CREATE INDEX by_name_surname ON accounts(name(10), surname(15)) Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Make find_or_create and find_or_initialize work mixing explicit parameters ↵Santiago Pastorino2010-05-071-1/+17
| | | | | | and a hash [#4457 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix unintuitive behavior with multiple order and group clausesErnie Miller2010-05-061-0/+10
| | | | | | [#4545 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Use primary key in conditions, not 'id' [#4395 state:resolved]Mathieu Arnold2010-05-041-0/+25
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax ↵Lawrence Pit2010-05-031-2/+2
| | | | | | for I18n Signed-off-by: José Valim <jose.valim@gmail.com>
* to_xml with :include should skip_instruct on the included records [#4506 ↵Lawrence Pit2010-04-302-1/+10
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* test cases for record.to_xml [#458 state:resolved]Neeraj Singh2010-04-302-0/+12
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Update after_commit and after_rollback docs and tests to use new style API ↵Brian Durand2010-04-291-6/+6
| | | | | | | | with an :on options instead of on_* suffix. [#2991] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Add after_commit and after_rollback callbacks to ActiveRecord that are ↵Brian Durand2010-04-292-14/+291
| | | | | | | | 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>
* making rake:migrate VERSION=0 a noop called in succession. [#2137 ↵Neeraj Singh2010-04-291-0/+19
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Move several configuration values from Hash to ActiveSupport::XmlMini, which ↵José Valim2010-04-292-6/+3
| | | | | | both Hash and Array depends on. Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array.
* Fix eager loading of associations causing table name collisionsErnie Miller2010-04-281-0/+9
| | | | | | [#4463 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Destroy respects optimistic locking.Curtis Hawthorne2010-04-271-3/+48
| | | | | | | | | | 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>