Skip to content

Commit

Permalink
Test with released Rails 7
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Dec 10, 2021
1 parent 2988f37 commit a766ced
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
fail-fast: false
matrix:
ruby: [ '2.7', '3.0.2', 'head' ]
rails: [ '6.0', '6.1', 'edge' ]
rails: [ '6.0', '6.1', '7.0', 'edge' ]

env:
RAILS_VERSION: ${{ matrix.rails }}
Expand Down
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ gemspec

if ENV["RAILS_VERSION"] == "edge"
gem "activesupport", github: "rails/rails", branch: "main"
elsif ENV['RAILS_VERSION'] == "7.0"
gem "activesupport", ">= 7.0.0.alpha"
">= 7.0.0.alpha"
elsif ENV["RAILS_VERSION"]
gem "activesupport", "~> #{ENV["RAILS_VERSION"] || "6.1"}.0"
gem "activesupport", "~> #{ENV["RAILS_VERSION"]}.0"
end
11 changes: 7 additions & 4 deletions test/support/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class AcceptanceTest < ActiveSupport::TestCase

def rails_version
if ENV['RAILS_VERSION'] == "edge"
"7.0.0.alpha"
"7.1.0.alpha"
elsif ENV['RAILS_VERSION'] == "7.0"
">= 7.0.0.alpha"
else
"~> #{ENV['RAILS_VERSION'] || "6.1"}.0"
end
Expand Down Expand Up @@ -157,7 +159,7 @@ def without_gem(name)
end

test "code changes in pre-referenced app files are picked up" do
File.write(app.path("config/initializers/load_posts_controller.rb"), "PostsController\n")
File.write(app.path("config/initializers/load_posts_controller.rb"), "Rails.application.config.to_prepare { PostsController }\n")

assert_speedup do
assert_success app.spring_test_command, stdout: "0 failures"
Expand Down Expand Up @@ -519,7 +521,8 @@ def exec_name
test "changing the Gemfile works" do
assert_success %(bin/rails runner 'require "sqlite3"')

File.write(app.gemfile, app.gemfile.read.gsub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
File.write(app.gemfile, app.gemfile.read.gsub(%r{gem ['"]sqlite3['"]}, %{# gem "sqlite3"}))
puts app.gemfile.read
app.await_reload

assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
Expand All @@ -531,7 +534,7 @@ def exec_name

assert_success %(bin/rails runner 'require "sqlite3"')

File.write(app.gems_rb, app.gems_rb.read.sub(%{gem 'sqlite3'}, %{# gem 'sqlite3'}))
File.write(app.gems_rb, app.gems_rb.read.gsub(%r{gem ['"]sqlite3['"]}, %{# gem "sqlite3"}))
app.await_reload

assert_failure %(bin/rails runner 'require "sqlite3"'), stderr: "sqlite3"
Expand Down

0 comments on commit a766ced

Please sign in to comment.