aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
Commit message (Collapse)AuthorAgeFilesLines
...
* set the configured #inheritance_column on #become (#7503)Yves Senn2012-09-031-0/+9
| | | | | | | | | | | | | | | I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber"> /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti'
* reset_counters() was crashing when there were multiple belongs_to ↵Dave Desrochers2012-08-212-0/+7
| | | | | | associations with the same foreign key. This closes #5200.
* Fix occasional microsecond conversion inaccuracyAri Pollak2012-08-151-1/+1
| | | | | | | | | ActiveRecord::ConnectionAdapters::Column#microseconds did an unnecessary conversion to from Rational to float when calculating the integer number of microseconds. Some terminating decimal numbers in base10 are repeating decimal numbers in base2 (the format of float), and occasionally this causes a rounding error. Patch & explanation originally from Logan Bowers.
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
* Fix backward compatibility with stored Hash values. Wrap coders to convert ↵Jeremy Kemper2012-05-301-0/+3
| | | | serialized values to indifferent access.
* Tests for removing a HABTM association when optimistic locking is enabled.Nick Rogers2012-03-071-0/+3
|
* added test for #3732Rick Martinez2012-02-102-0/+4
|
* Replaced all 'for' loops with Enumerable#eachNathan Broadbent2012-01-301-1/+1
|
* Fix bug where reset_counters resets the wrong counter cache.David Peter2012-01-162-0/+7
| | | | | | | | If a model belongs_to two associations with the same class, then reset_counters will reset the wrong counter cache. Finding the right reflection should use the foreign_key instead, which should be unique.
* Test fixtures with custom model and table namesAlexey Muranov2011-12-303-0/+21
| | | | | | Test using fixtures with random names and model names, that is not following naming conventions but using set_fixture_class instead. It is expected that the table name be defined in the model, but this is not explicitly tested here. This will need to be fixed.
* Fix a fixtures test case with table prefix/suffixAlexey Muranov2011-12-271-0/+42
| | | | Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix.
* Fixtures support for ActiveRecord::ModelJon Leighton2011-12-241-0/+3
|
* Revert "Merge pull request #4114 from ↵Jon Leighton2011-12-221-42/+0
| | | | | | | | | alexeymuranov/my_fix_for_prefix_suffix_fixtures_test" This reverts commit f8e484d0f71114675ed04e987914d3f2815cb868, reversing changes made to fa5adfb1e884bf21a7071ade634a820e37ac4db4. Reason: broke the postgres tests.
* Fix a fixtures test case with table prefix/suffixAlexey Muranov2011-12-221-0/+42
| | | Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix. This was somebody else's test case, so an independent opinion on the change can be helpful.
* restores the API docs of AR::Fixtures, made a quick pass over them, revises ↵Xavier Noria2011-09-031-1/+1
| | | | link in fixture template [closes #2840]
* Quote these dates to prevent intermittent test failure. Suppose local time ↵Jon Leighton2011-08-041-2/+2
| | | | is 00:50 GMT+1. Without the quoting, the YAML parser would parse this as 00:50 UTC, into the local time of 01:50 GMT+1. Then, it would get written into the database in local time as 01:50. When it came back out the UTC date from the database and the UTC date of two weeks ago would be compared. The former would be 23:50, and the latter would be 00:50, so the two dates would differ, causing the assertion to fail. Quoting it prevents the YAML parser from getting involved.
* Revert "this fixes a brittle test in fixtures_test.rb which fails when you ↵Aaron Patterson2011-07-201-2/+2
| | | | | | are in a timezone which is ahead of UTC but UTC is in the previous day still." This reverts commit f92cefa95f44bcd550c402a7f5ba914f3bd783cc.
* this fixes a brittle test in fixtures_test.rb which fails when you are in a ↵Josh Kalderimis2011-07-201-2/+2
| | | | timezone which is ahead of UTC but UTC is in the previous day still.
* Revert "Fix failure in test_preserves_existing_fixture_data from ↵Jon Leighton2011-07-171-2/+2
| | | | | | test/cases/fixtures_test.rb when UTC and local time occur on different dates." I am pretty sure this was an incorrect fix, and it still failed in certain circumstances anyway. I am now unable to reproduce the original failure I was experiencing so will leave it for now and see if this pops up again. This reverts commit e4479b2f1bc54edf155408d51dd3236955150ce1.
* Fix failure in test_preserves_existing_fixture_data from ↵Jon Leighton2011-07-121-2/+2
| | | | test/cases/fixtures_test.rb when UTC and local time occur on different dates.
* properly reference yml alias nodesdmathieu2011-05-241-1/+1
| | | | as per the last version of the yml specifications : http://www.yaml.org/spec/1.2/spec.html#* alias//
* fixing 1.8 support for new fixture testsAaron Patterson2011-05-231-1/+1
|
* Don't use select() values from the join model of a through association. ↵Jon Leighton2011-05-111-0/+7
| | | | Fixes #508.
* deprecating CSV fixture supportAaron Patterson2011-05-101-0/+0
|
* Don't quote ID's as Arel will quote them -- follow same conventions as the ↵Christopher Meiklejohn2011-05-081-0/+7
| | | | delete method.
* Namespace Fixtures in ActiveRecordJason Noble2011-05-072-6/+6
| | | [Fixes #439]
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-101-1/+1
|\
| * revises links to the API websites of individual components (no longer ↵Xavier Noria2011-03-091-1/+1
| | | | | | | | maintained), and rewrites the section about after and around filters in the controller guide
* | Add a test for STI on the through where the through is nested, and change ↵Jon Leighton2011-03-051-0/+10
| | | | | | | | the code which support this
* | Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-047-2/+23
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-159-8/+30
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb
| | * Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-0/+2
| | | | | | | | | | | | state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
| | * has_one should always remove the old record (properly), even if not saving ↵Jon Leighton2011-01-111-0/+1
| | | | | | | | | | | | the new record, so we don't get the database into a pickle
| | * Make serialized fixtures work againPratik Naik2010-12-291-0/+6
| | |
| | * Associations: DRY up the code which is generating conditions, and make it ↵Jon Leighton2010-12-261-1/+0
| | | | | | | | | | | | all use arel rather than SQL strings
| | * Fix dodgy tests which were effectively asserting nil == nilJon Leighton2010-12-261-0/+1
| | |
| | * using arel to compile sql statementsAaron Patterson2010-12-251-0/+1
| | |
| | * If a has_many goes :through a belongs_to, and the foreign key of the ↵Jon Leighton2010-12-235-8/+20
| | | | | | | | | | | | belongs_to changes, then the has_many should be considered stale.
| * | IdentityMap - Tests for IMMarcin Raczkowski2010-11-191-0/+4
| |/
| * Add some tests for functionality in JoinAssociation which already exists but ↵Jon Leighton2010-10-131-0/+6
| | | | | | | | was previously untested
* | Support the :primary_key option on a through reflection in a nested through ↵Jon Leighton2010-10-191-0/+2
| | | | | | | | association
* | Support for :primary_key option on the source reflection of a through ↵Jon Leighton2010-10-192-1/+2
| | | | | | | | association, where the source is a has_one or has_many
* | Respect the :primary_key option on the through_reflection of (non-nested) ↵Jon Leighton2010-10-191-0/+6
| | | | | | | | through associations
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-193-0/+46
| | | | | | | | through association
* | Add test_has_one_through_has_one_through_with_belongs_to_source_reflectionJon Leighton2010-10-143-1/+13
| |
* | Added ↵Jon Leighton2010-10-141-0/+6
| | | | | | | | test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass
* | First bit of support for habtm in through assocs - ↵Jon Leighton2010-10-132-2/+7
| | | | | | | | test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection now passes
* | Add a commented, failing test for using a habtm in a has many through ↵Jon Leighton2010-10-121-0/+8
| | | | | | | | association. I want to refactor how aliasing works first.
* | Adding test_has_many_through_has_one_with_has_many_through_source_reflection ↵Jon Leighton2010-10-121-0/+5
| | | | | | | | and modifying ThroughAssociationScope to make it work correctly.
* | Support has_one through assocs as the source associationJon Leighton2010-10-124-6/+14
| |