File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 MYSQL_DB_HOST : 127.0.0.1
2323 MYSQL_DB_USERNAME : root
2424 MYSQL_DB_PASSWORD : root
25- RAILS_7 : true
25+ RAILS : ' 7.0 '
2626
2727 services :
2828 mysql :
Original file line number Diff line number Diff line change 2222 PG_DB_HOST : 127.0.0.1
2323 PG_DB_USERNAME : postgres
2424 PG_DB_PASSWORD : postgres
25- RAILS_7 : true
25+ RAILS : ' 7.0 '
2626
2727 services :
2828 postgres :
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
1616 rdoc . rdoc_files . include ( 'lib/**/*.rb' )
1717end
1818
19- dummy_app = ENV [ 'RAILS_7 ' ] ? 'dummy7' : 'dummy'
19+ dummy_app = ( ENV [ 'RAILS ' ] == '7.0' ? 'dummy7' : 'dummy' )
2020APP_RAKEFILE = File . expand_path ( "spec/#{ dummy_app } /Rakefile" , __dir__ )
2121load 'rails/tasks/engine.rake'
2222
Original file line number Diff line number Diff line change 55ENV [ 'DB_TEST' ] ||= 'postgres'
66ENV [ 'RAILS_ENV' ] ||= 'test'
77
8- dummy_app = ENV [ 'RAILS_7 ' ] ? 'dummy7' : 'dummy'
8+ dummy_app = ( ENV [ 'RAILS ' ] == '7.0' ? 'dummy7' : 'dummy' )
99
1010ENGINE_ROOT = File . expand_path ( '..' , __dir__ )
1111ENGINE_PATH = File . expand_path ( '../lib/active_storage_db/engine' , __dir__ )
Original file line number Diff line number Diff line change 11# Development
22
33``` sh
4+ # Running tests on Rails 6.0:
5+ DB_TEST=postgres RAILS=6.0 bin/appraisal rails-6_0-postgres rails db:drop db:create db:migrate
6+ DB_TEST=postgres RAILS=6.0 bin/appraisal rails-6_0-postgres rspec
7+
48# Running tests on Rails 6.1:
5- DB_TEST=postgres bin/appraisal rails-6_1-postgres rspec
9+ DB_TEST=postgres RAILS=6.1 bin/appraisal rails-6_1-postgres rails db:drop db:create db:migrate
10+ DB_TEST=postgres RAILS=6.1 bin/appraisal rails-6_1-postgres rspec
11+
612# Running tests on Rails 7.0:
7- DB_TEST=postgres RAILS_7=1 bin/appraisal rails-7_0-postgres rspec
13+ DB_TEST=postgres RAILS=7.0 bin/appraisal rails-7_0-postgres rails db:drop db:create db:migrate
14+ DB_TEST=postgres RAILS=7.0 bin/appraisal rails-7_0-postgres rspec
815```
916
1017## Tests using Docker
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ test: &test
44 adapter : mysql2
55 host : <%= ENV.fetch('MYSQL_DB_HOST') { '127.0.0.1' } %>
66 # port: <%= ENV.fetch('MYSQL_DB_PORT') { 3306 } %>
7- database : <%= ENV.fetch('MYSQL_DB_NAME') { 'active_storage_db -test' } %>
7+ database : <%= ENV.fetch('MYSQL_DB_NAME') { "active_storage_db_#{ENV['RAILS']&.tr('.', '')} -test" } %>
88 username : <%= ENV.fetch('MYSQL_DB_USERNAME') { '' } %>
99 password : <%= ENV.fetch('MYSQL_DB_PASSWORD') { '' } %>
1010 encoding : utf8
@@ -13,7 +13,7 @@ test: &test
1313test : &test
1414 adapter : postgresql
1515 host : <%= ENV.fetch('PG_DB_HOST') { '127.0.0.1' } %>
16- database : <%= ENV.fetch('PG_DB_NAME') { 'active_storage_db -test' } %>
16+ database : <%= ENV.fetch('PG_DB_NAME') { "active_storage_db_#{ENV['RAILS']&.tr('.', '')} -test" } %>
1717 username : <%= ENV.fetch('PG_DB_USERNAME') { '' } %>
1818 password : <%= ENV.fetch('PG_DB_PASSWORD') { '' } %>
1919 encoding : utf8
@@ -25,4 +25,4 @@ test: &test
2525
2626development :
2727 << : *test
28- database : active_storage_db -dev
28+ database : " active_storage_db_#{ENV['RAILS']&.tr('.', '')} -dev"
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ test: &test
44 adapter : mysql2
55 host : <%= ENV.fetch('MYSQL_DB_HOST') { '127.0.0.1' } %>
66 # port: <%= ENV.fetch('MYSQL_DB_PORT') { 3306 } %>
7- database : <%= ENV.fetch('MYSQL_DB_NAME') { 'active_storage_db -test' } %>
7+ database : <%= ENV.fetch('MYSQL_DB_NAME') { "active_storage_db_#{ENV['RAILS']&.tr('.', '')} -test" } %>
88 username : <%= ENV.fetch('MYSQL_DB_USERNAME') { '' } %>
99 password : <%= ENV.fetch('MYSQL_DB_PASSWORD') { '' } %>
1010 encoding : utf8
@@ -13,7 +13,7 @@ test: &test
1313test : &test
1414 adapter : postgresql
1515 host : <%= ENV.fetch('PG_DB_HOST') { '127.0.0.1' } %>
16- database : <%= ENV.fetch('PG_DB_NAME') { 'active_storage_db -test' } %>
16+ database : <%= ENV.fetch('PG_DB_NAME') { "active_storage_db_#{ENV['RAILS']&.tr('.', '')} -test" } %>
1717 username : <%= ENV.fetch('PG_DB_USERNAME') { '' } %>
1818 password : <%= ENV.fetch('PG_DB_PASSWORD') { '' } %>
1919 encoding : utf8
@@ -25,4 +25,4 @@ test: &test
2525
2626development :
2727 << : *test
28- database : active_storage_db -dev
28+ database : " active_storage_db_#{ENV['RAILS']&.tr('.', '')} -dev"
Original file line number Diff line number Diff line change 1111require 'spec_helper'
1212ENV [ 'RAILS_ENV' ] ||= 'test'
1313
14- dummy_app = ENV [ 'RAILS_7 ' ] ? 'dummy7' : 'dummy'
14+ dummy_app = ( ENV [ 'RAILS ' ] == '7.0' ? 'dummy7' : 'dummy' )
1515require File . expand_path ( "#{ dummy_app } /config/environment.rb" , __dir__ )
1616
1717abort ( 'The Rails environment is running in production mode!' ) if Rails . env . production?
You can’t perform that action at this time.
0 commit comments