diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-16 10:42:48 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-16 10:42:48 -0800 |
commit | d9b6abe2b818cf8ec852dbf9b4cf8efda2da8eff (patch) | |
tree | 8a9ab959ec7595f5a254f72f3541a93f79a88c4c /activerecord | |
parent | 4c76040e78f1c752d32ee802791fcc37c4c78b46 (diff) | |
parent | 456d308f47ae95dbb59593509dc9348ecaf06368 (diff) | |
download | rails-d9b6abe2b818cf8ec852dbf9b4cf8efda2da8eff.tar.gz rails-d9b6abe2b818cf8ec852dbf9b4cf8efda2da8eff.tar.bz2 rails-d9b6abe2b818cf8ec852dbf9b4cf8efda2da8eff.zip |
Merge pull request #12911 from zenspider/test_order_dependency_fixes
Test order dependency fixes
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/fixtures_test.rb | 16 | ||||
-rw-r--r-- | activerecord/test/cases/validations/i18n_generate_message_validation_test.rb | 24 |
2 files changed, 26 insertions, 14 deletions
diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index bffff07089..f3a4887a85 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -624,20 +624,24 @@ class FixturesBrokenRollbackTest < ActiveRecord::TestCase end class LoadAllFixturesTest < ActiveRecord::TestCase - self.fixture_path = FIXTURES_ROOT + "/all" - fixtures :all - def test_all_there + self.class.fixture_path = FIXTURES_ROOT + "/all" + self.class.fixtures :all + assert_equal %w(admin/accounts admin/users developers people tasks), fixture_table_names.sort + ensure + ActiveRecord::FixtureSet.reset_cache end end class LoadAllFixturesWithPathnameTest < ActiveRecord::TestCase - self.fixture_path = Pathname.new(FIXTURES_ROOT).join('all') - fixtures :all - def test_all_there + self.class.fixture_path = Pathname.new(FIXTURES_ROOT).join('all') + self.class.fixtures :all + assert_equal %w(admin/accounts admin/users developers people tasks), fixture_table_names.sort + ensure + ActiveRecord::FixtureSet.reset_cache end end diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb index 32d2bf746f..a73c3bf1af 100644 --- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb @@ -55,22 +55,30 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase end test "translation for 'taken' can be overridden" do - I18n.backend.store_translations "en", {errors: {attributes: {title: {taken: "Custom taken message" }}}} - assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + reset_i18n_load_path do + I18n.backend.store_translations "en", {errors: {attributes: {title: {taken: "Custom taken message" }}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end end test "translation for 'taken' can be overridden in activerecord scope" do - I18n.backend.store_translations "en", {activerecord: {errors: {messages: {taken: "Custom taken message" }}}} - assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + reset_i18n_load_path do + I18n.backend.store_translations "en", {activerecord: {errors: {messages: {taken: "Custom taken message" }}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end end test "translation for 'taken' can be overridden in activerecord model scope" do - I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {taken: "Custom taken message" }}}}} - assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + reset_i18n_load_path do + I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {taken: "Custom taken message" }}}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end end test "translation for 'taken' can be overridden in activerecord attributes scope" do - I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {attributes: {title: {taken: "Custom taken message" }}}}}}} - assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + reset_i18n_load_path do + I18n.backend.store_translations "en", {activerecord: {errors: {models: {topic: {attributes: {title: {taken: "Custom taken message" }}}}}}} + assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title') + end end end |