spec/rails_test_spec.rb in appmap-0.78.0 vs spec/rails_test_spec.rb in appmap-0.79.0
- old
+ new
@@ -1,11 +1,11 @@
require 'rails_spec_helper'
# Rails5 doesn't work with Ruby 3.x, Rails 7 doesn't work with Ruby < 2.7.
def default_rails_versions
if testing_ruby_2?
- if Gem::Requirement.create('>= 2.7') =~ Gem::Version.new(ENV['RUBY_VERSION'])
+ if Gem::Requirement.create('>= 2.7') =~ Gem::Version.new(RUBY_VERSION)
[ 5, 6, 7 ]
else
[ 5, 6 ]
end
else
@@ -19,27 +19,17 @@
describe 'Rails' do
rails_versions.each do |rails_major_version| # rubocop:disable Metrics/BlockLength
context "#{rails_major_version}" do
include_context 'Rails app pg database', "spec/fixtures/rails#{rails_major_version}_users_app" unless use_existing_data?
- def tmpdir
- 'tmp/spec/rails_test_spec'
- end
- before(:all) do
- FileUtils.rm_rf tmpdir
- FileUtils.mkdir_p tmpdir
- end
- def run_tests
- cmd = <<~CMD.gsub "\n", ' '
- docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true -e TEST_OPTS=--verbose
- -v #{File.absolute_path tmpdir}:/app/tmp app bundle exec rake
- CMD
- run_cmd cmd, chdir: fixture_dir
- end
-
it 'runs tests with APPMAP=true' do
- run_tests
+ app.prepare_db
+ app.run_cmd \
+ 'bundle exec rake',
+ 'RAILS_ENV' => 'test',
+ 'APPMAP' => 'true',
+ 'TEST_OPTS' => '--verbose'
end
end
end
end