aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDaniel Colson <danieljamescolson@gmail.com>2018-04-20 20:12:24 -0400
committerDaniel Colson <danieljamescolson@gmail.com>2018-04-20 20:12:24 -0400
commitc03c519db0f5bcbb9f1151db5774921ea9bd3a22 (patch)
tree6bfb7c45be14884f41c79242cf54ce024afb2786 /activerecord
parent1694b02909850c9d8f47fb644e98e1203d9f2898 (diff)
downloadrails-c03c519db0f5bcbb9f1151db5774921ea9bd3a22.tar.gz
rails-c03c519db0f5bcbb9f1151db5774921ea9bd3a22.tar.bz2
rails-c03c519db0f5bcbb9f1151db5774921ea9bd3a22.zip
Relax assertions in connection config tests
At the moment these two ActiveRecord tests pass with `rake test:sqlite3`, but fail with `ARCONN=sqlite3 bin/test`. `Rails.root` is defined when running `bin/test`, but not when running the rake task. When `Rails.root` is defined, `config[:database]` will look something like `vagrant/rails/activerecord/db/primary.sqlite3` instead of just `db/primary.sqlite3`. (See https://github.com/rails/rails/blob/00caf95e14b90782ab17fbd6d2b930844df99980/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L27) Relaxing `assert_equal` to `assert_match` will allow these tests to pass regardless of how they are run. I do have a question why we need both ways to run tests. I have been using `bin/test` lately, but I see from #32426 that this is not the preferred method.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
index 57b3a5844e..b8e623f17b 100644
--- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb
+++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -89,7 +89,7 @@ module ActiveRecord
ActiveRecord::Base.establish_connection
- assert_equal "db/primary.sqlite3", ActiveRecord::Base.connection.pool.spec.config[:database]
+ assert_match "db/primary.sqlite3", ActiveRecord::Base.connection.pool.spec.config[:database]
ensure
ActiveRecord::Base.configurations = @prev_configs
ENV["RAILS_ENV"] = previous_env
@@ -112,7 +112,7 @@ module ActiveRecord
ActiveRecord::Base.establish_connection
- assert_equal "db/primary.sqlite3", ActiveRecord::Base.connection.pool.spec.config[:database]
+ assert_match "db/primary.sqlite3", ActiveRecord::Base.connection.pool.spec.config[:database]
ensure
ActiveRecord::Base.configurations = @prev_configs
ENV["RAILS_ENV"] = previous_env