aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/time_travel_test.rb
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-09-03 11:40:16 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2018-09-04 23:08:54 +0300
commit5f244f6b0680f161280d3832943e0e9632a9c0de (patch)
treeaad778295e8e86b021ce737c616d31c0dbc2f70a /activesupport/test/time_travel_test.rb
parentfb3642b0caf42b0554a8fd0672943f4da1643b2c (diff)
downloadrails-5f244f6b0680f161280d3832943e0e9632a9c0de.tar.gz
rails-5f244f6b0680f161280d3832943e0e9632a9c0de.tar.bz2
rails-5f244f6b0680f161280d3832943e0e9632a9c0de.zip
Fix tests in `activerecord/test/cases/tasks/database_tasks_test.rb`
After #33637 some tests in `activerecord/test/cases/tasks/database_tasks_test.rb` don't assert anything. We used to stub `ActiveRecord::Base::configurations` method in those tests like `ActiveRecord::Base.stub(:configurations, @configurations) {}`. Since #33637 `ActiveRecord::Base::configurations` is a `ActiveRecord::DatabaseConfigurations` object(not a Hash object) we can't do so anymore. `ActiveRecord::DatabaseConfigurations` object builds during `ActiveRecord::Base::configurations=`. We can replace `ActiveRecord::Base.stub(:configurations, @configurations) {}` to ``` begin old_configurations = ActiveRecord::Base.configurations ActiveRecord::Base.configurations = @configurations # ... ensure ActiveRecord::Base.configurations = old_configurations end ``` Also I fixed tests in `activerecord/test/cases/tasks/legacy_database_tasks_test.rb` But currently It looks like duplication of `activerecord/test/cases/tasks/database_tasks_test.rb`. We should improve those tests or remove them. I've tried (in `activerecord/test/cases/tasks/legacy_database_tasks_test.rb` file): ``` def with_stubbed_configurations old_configurations = ActiveRecord::Base.configurations.to_h ActiveRecord::Base.configurations = @configurations ActiveRecord::Base.stub(:configurations, ActiveRecord::Base.configurations.to_h) do yield end ensure ActiveRecord::Base.configurations = old_configurations end ``` but it causes erros in tests cases. After discussion we decided to remove `activerecord/test/cases/tasks/legacy_database_tasks_test.rb` Related to #33637
Diffstat (limited to 'activesupport/test/time_travel_test.rb')
0 files changed, 0 insertions, 0 deletions