diff options
author | utilum <oz@utilum.com> | 2018-07-21 00:54:34 +0300 |
---|---|---|
committer | utilum <oz@utilum.com> | 2018-07-22 08:38:11 +0300 |
commit | d89937505867eac91830d34a97d55b08d48573fc (patch) | |
tree | 276d24b8ff30e2bec96f1dd4dbb3b6c5e5be6689 | |
parent | a94d6ae81fea43d075ab31d53c54d3065c57d233 (diff) | |
download | rails-d89937505867eac91830d34a97d55b08d48573fc.tar.gz rails-d89937505867eac91830d34a97d55b08d48573fc.tar.bz2 rails-d89937505867eac91830d34a97d55b08d48573fc.zip |
Replace Mocha#stubs with assert_called_with
A correct, but not obvious use of `ActiveSupport::Testing::MethodCallAssertions`, which might also have been part of #33337 or #33391.
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/active_schema_test.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb index 58fa39d18c..6fc9df5083 100644 --- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb @@ -157,14 +157,19 @@ class Mysql2ActiveSchemaTest < ActiveRecord::Mysql2TestCase end def test_indexes_in_create - ActiveRecord::Base.connection.stubs(:data_source_exists?).with(:temp).returns(false) + assert_called_with( + ActiveRecord::Base.connection, + :data_source_exists?, + [:temp], + returns: false + ) do + expected = "CREATE TEMPORARY TABLE `temp` ( INDEX `index_temp_on_zip` (`zip`)) AS SELECT id, name, zip FROM a_really_complicated_query" + actual = ActiveRecord::Base.connection.create_table(:temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query") do |t| + t.index :zip + end - expected = "CREATE TEMPORARY TABLE `temp` ( INDEX `index_temp_on_zip` (`zip`)) AS SELECT id, name, zip FROM a_really_complicated_query" - actual = ActiveRecord::Base.connection.create_table(:temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query") do |t| - t.index :zip + assert_equal expected, actual end - - assert_equal expected, actual end private |