From a184f64741b9c9aafa59212178dd1d8ef0e423ed Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Mon, 28 Oct 2024 23:03:38 +0100 Subject: [PATCH] Support Rails 8.0 --- .github/workflows/ci.yml | 5 ++--- CHANGELOG.md | 4 ++++ Gemfile | 4 ++-- README.md | 10 ++++++++-- ...ails-7.2.0.gemfile => rails-8.0.0.gemfile} | 4 ++-- lib/minitest/rails/assertions/action_cable.rb | 20 +++++++++---------- .../rails/assertions/action_mailer.rb | 10 +++++----- .../rails/assertions/active_support.rb | 8 ++++---- .../rails/expectations/action_cable.rb | 14 ++++++------- .../rails/expectations/action_mailer.rb | 10 +++++----- .../rails/expectations/active_support.rb | 8 ++++---- lib/minitest/rails/version.rb | 2 +- minitest-rails.gemspec | 4 ++-- test/helper.rb | 2 +- 14 files changed, 57 insertions(+), 48 deletions(-) rename gemfiles/{rails-7.2.0.gemfile => rails-8.0.0.gemfile} (81%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3a501b..665b7a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,10 @@ jobs: fail-fast: false matrix: ruby: - - '3.1' - '3.2' - '3.3' gemfile: - - gemfiles/rails-7.2.0.gemfile + - gemfiles/rails-8.0.0.gemfile env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} @@ -54,7 +53,7 @@ jobs: - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.1 + ruby-version: 3.2 bundler-cache: true - name: rubocop diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d5f98f..f22bdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changes +### 8.0.0 / 2024-10-28 + +Support Rails 8.0. + ### 7.2.0 / 2024-08-30 Support Rails 7.2. diff --git a/Gemfile b/Gemfile index b26e3c8..b9c7315 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,6 @@ source "http://rubygems.org" gemspec gem "irb" -gem "rails", "~> 7.2.0" +gem "rails", "~> 8.0.0" gem "rake" -gem "sqlite3", "~> 1.4" +gem "sqlite3", ">= 2.1" diff --git a/README.md b/README.md index d8964c4..69bbc57 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # minitest-rails -Minitest integration for Rails 7.2 +Minitest integration for Rails 8.0 [![CI](https://github.com/minitest/minitest-rails/actions/workflows/ci.yml/badge.svg)](https://github.com/minitest/minitest-rails/actions/workflows/ci.yml) [![CodeQL](https://github.com/minitest/minitest-rails/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/minitest/minitest-rails/actions/workflows/github-code-scanning/codeql) @@ -22,7 +22,13 @@ Create a new rails app: ### Choosing a version This gem follows the versioning of Rails. -For example, if you are using Rails 7.2 you will specify: +For example, if you are using Rails 8.0 you will specify: + +```ruby +gem "minitest-rails", "~> 8.0.0" +``` + +If you are running Rails 7.2 you will specify: ```ruby gem "minitest-rails", "~> 7.2.0" diff --git a/gemfiles/rails-7.2.0.gemfile b/gemfiles/rails-8.0.0.gemfile similarity index 81% rename from gemfiles/rails-7.2.0.gemfile rename to gemfiles/rails-8.0.0.gemfile index d4312d2..6cd084d 100644 --- a/gemfiles/rails-7.2.0.gemfile +++ b/gemfiles/rails-8.0.0.gemfile @@ -1,9 +1,9 @@ source "http://rubygems.org" gem "minitest-rails", path: "../" -gem "rails", "7.2.0" +gem "rails", "~> 8.0.0" gem "rake" -gem "sqlite3", "~> 1.4" +gem "sqlite3", ">= 2.1" gem "minitest-autotest", "~> 1.1" gem "minitest-focus", "~> 1.4" diff --git a/lib/minitest/rails/assertions/action_cable.rb b/lib/minitest/rails/assertions/action_cable.rb index dc61217..00674b8 100644 --- a/lib/minitest/rails/assertions/action_cable.rb +++ b/lib/minitest/rails/assertions/action_cable.rb @@ -25,7 +25,7 @@ class ActionCable::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_have_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: assert_broadcasts # :call-seq: assert_broadcasts(stream, number) @@ -52,7 +52,7 @@ class ActionCable::TestCase # assert_broadcasts 'messages', 0, &block # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: refute_broadcasts # :call-seq: refute_broadcasts(stream, &block) @@ -75,7 +75,7 @@ class ActionCable::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_broadcast_on - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: assert_broadcast_on # :call-seq: assert_broadcast_on(stream, data) @@ -108,7 +108,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_have_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: assert_broadcasts # :call-seq: assert_broadcasts(stream, number) @@ -135,7 +135,7 @@ class ActionCable::Channel::TestCase # assert_broadcasts 'messages', 0, &block # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: refute_broadcasts # :call-seq: refute_broadcasts(stream, &block) @@ -158,7 +158,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::TestHelper#must_broadcast_on - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: assert_broadcast_on # :call-seq: assert_broadcast_on(stream, data) @@ -172,7 +172,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#wont_have_streams - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams # # :method: refute_streams alias refute_streams assert_no_streams @@ -186,7 +186,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#must_have_streams - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream # # :method: assert_has_stream # :call-seq: assert_has_stream(stream) @@ -200,7 +200,7 @@ class ActionCable::Channel::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable::Channel#must_have_stream_for - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for # # :method: assert_has_stream_for # :call-seq: assert_has_stream_for(object) @@ -226,7 +226,7 @@ class ActionCable::Connection::TestCase # end # # See also Minitest::Rails::Expectations::ActionCable#must_reject_connection - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection # # :method: assert_reject_connection end diff --git a/lib/minitest/rails/assertions/action_mailer.rb b/lib/minitest/rails/assertions/action_mailer.rb index e17f4cc..a308b4d 100644 --- a/lib/minitest/rails/assertions/action_mailer.rb +++ b/lib/minitest/rails/assertions/action_mailer.rb @@ -25,7 +25,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_have_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_emails # # :method: assert_emails # :call-seq: assert_emails(number, &block) @@ -51,7 +51,7 @@ class ActionMailer::TestCase # assert_emails 0, &block # # See also Minitest::Rails::Expectations::ActionMailer#wont_have_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails # # :method: refute_emails # :call-seq: refute_emails(&block) @@ -84,7 +84,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_have_enqueued_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails # # :method: assert_enqueued_emails # :call-seq: assert_enqueued_emails(number, &block) @@ -122,7 +122,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#must_enqueue_email_with - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with # # :method: assert_enqueued_email_with # :call-seq: assert_enqueued_email_with(mailer, method, args: nil, queue: "mailers", &block) @@ -145,7 +145,7 @@ class ActionMailer::TestCase # end # # See also Minitest::Rails::Expectations::ActionMailer#wont_have_enqueued_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails # # :method: refute_enqueued_emails # :call-seq: refute_enqueued_emails(&block) diff --git a/lib/minitest/rails/assertions/active_support.rb b/lib/minitest/rails/assertions/active_support.rb index d512f9b..1da3721 100644 --- a/lib/minitest/rails/assertions/active_support.rb +++ b/lib/minitest/rails/assertions/active_support.rb @@ -8,7 +8,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#must_change - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes # # :method: assert_changes # :call-seq: assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block) @@ -22,7 +22,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#wont_change - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes # # :args: expression, message = nil, &block alias refute_changes assert_no_changes @@ -36,7 +36,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#must_change - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference # # :method: assert_difference # :call-seq: assert_difference(expression, *args, &block) @@ -50,7 +50,7 @@ class ActiveSupport::TestCase # end # # See also Minitest::Rails::Expectations::ActiveSupport#wont_change - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference # # :args: expression, message = nil, &block alias refute_difference assert_no_difference diff --git a/lib/minitest/rails/expectations/action_cable.rb b/lib/minitest/rails/expectations/action_cable.rb index 95a5cb7..507b722 100644 --- a/lib/minitest/rails/expectations/action_cable.rb +++ b/lib/minitest/rails/expectations/action_cable.rb @@ -31,7 +31,7 @@ module TestHelper # end # # See also ActionCable::TestHelper#assert_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcasts # # :method: must_have_broadcasts # :call-seq: must_have_broadcasts(stream, number) @@ -58,7 +58,7 @@ module TestHelper # must_have_broadcasts 'messages', 0, &block # # See also ActionCable::TestHelper#wont_have_broadcasts - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_no_broadcasts # # :method: wont_have_broadcasts # :call-seq: wont_have_broadcasts(stream, &block) @@ -80,7 +80,7 @@ module TestHelper # end # # See also ActionCable::TestHelper#assert_broadcast_on - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/TestHelper.html#method-i-assert_broadcast_on # # :method: must_broadcast_on # :call-seq: must_broadcast_on(stream, data) @@ -104,7 +104,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_no_streams - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_no_streams # # :method: wont_have_streams @@ -117,7 +117,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_has_stream - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream # # :method: must_have_streams # :call-seq: must_have_streams(stream) @@ -131,7 +131,7 @@ module Channel # end # # See also ActionCable::Channel::TestCase#assert_has_stream_for - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Channel/TestCase/Behavior.html#method-i-assert_has_stream_for # # :method: must_have_stream_for # :call-seq: must_have_stream_for(object) @@ -166,7 +166,7 @@ module Connection # end # # See also ActionCable::Connection::TestCase#assert_reject_connection - # See https://api.rubyonrails.org/v7.2/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection + # See https://api.rubyonrails.org/v8.0/classes/ActionCable/Connection/Assertions.html#method-i-assert_reject_connection # # :method: must_reject_connection diff --git a/lib/minitest/rails/expectations/action_mailer.rb b/lib/minitest/rails/expectations/action_mailer.rb index 32b5349..56d42e0 100644 --- a/lib/minitest/rails/expectations/action_mailer.rb +++ b/lib/minitest/rails/expectations/action_mailer.rb @@ -30,7 +30,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_emails # # :method: must_have_emails # :call-seq: must_have_emails(number, &block) @@ -56,7 +56,7 @@ module ActionMailer # must_have_emails 0, &block # # See also ActionMailer::TestClass#wont_have_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_emails # # :method: wont_have_emails # :call-seq: wont_have_emails(&block) @@ -88,7 +88,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_enqueued_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_emails # # :method: must_have_enqueued_emails # :call-seq: must_have_enqueued_emails(number, &block) @@ -126,7 +126,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_enqueued_email_with - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_enqueued_email_with # # :method: must_enqueue_email_with # :call-seq: must_enqueue_email_with(mailer, method, args: nil, queue: "mailers", &block) @@ -149,7 +149,7 @@ module ActionMailer # end # # See also ActionMailer::TestClass#assert_no_enqueued_emails - # See https://api.rubyonrails.org/v7.2/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails + # See https://api.rubyonrails.org/v8.0/classes/ActionMailer/TestHelper.html#method-i-assert_no_enqueued_emails # # :method: wont_have_enqueued_emails # :call-seq: wont_have_enqueued_emails(&block) diff --git a/lib/minitest/rails/expectations/active_support.rb b/lib/minitest/rails/expectations/active_support.rb index f01c8da..31c8f03 100644 --- a/lib/minitest/rails/expectations/active_support.rb +++ b/lib/minitest/rails/expectations/active_support.rb @@ -12,7 +12,7 @@ module ActiveSupport # end }.must_change "User.count", from: 5, to: 8 # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes # # :method: must_change # :args: expression, from: UNTRACKED, to: UNTRACKED @@ -27,7 +27,7 @@ module ActiveSupport # end # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes # # :method: wont_change # :args: expression @@ -43,7 +43,7 @@ module ActiveSupport # end }.must_differ "User.count", 3 # # See also ActiveSupport::TestCase#assert_difference - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference # # :method: must_differ # :args: expression, *args @@ -56,7 +56,7 @@ module ActiveSupport # value { User.new }.wont_differ "User.count" # # See also ActiveSupport::TestCase#refute_difference - # See https://api.rubyonrails.org/v7.2/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference + # See https://api.rubyonrails.org/v8.0/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference # # :method: wont_differ # :args: expression diff --git a/lib/minitest/rails/version.rb b/lib/minitest/rails/version.rb index 8c0a45f..dd372f9 100644 --- a/lib/minitest/rails/version.rb +++ b/lib/minitest/rails/version.rb @@ -1,5 +1,5 @@ module Minitest module Rails - VERSION = "7.2.0".freeze + VERSION = "8.0.0".freeze end end diff --git a/minitest-rails.gemspec b/minitest-rails.gemspec index 6f9af43..27dd873 100644 --- a/minitest-rails.gemspec +++ b/minitest-rails.gemspec @@ -15,10 +15,10 @@ Gem::Specification.new do |gem| ["README.md", "UPDATING.md", "CHANGELOG.md", "LICENSE"] gem.require_paths = ["lib"] - gem.required_ruby_version = ">= 3.1.0" + gem.required_ruby_version = ">= 3.2.0" gem.add_dependency "minitest", "~> 5.20" - gem.add_dependency "railties", ">= 7.2.0", "< 8.0.0" + gem.add_dependency "railties", ">= 8.0.0", "< 8.1.0" gem.add_development_dependency "minitest-autotest", "~> 1.1" gem.add_development_dependency "minitest-focus", "~> 1.4" diff --git a/test/helper.rb b/test/helper.rb index 47e0295..d36137d 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -26,7 +26,7 @@ class Application < ::Rails::Application config.secret_key_base = "abc123" config.hosts << "www.example.com" config.eager_load = false - config.load_defaults 7.2 + config.load_defaults 8.0 end end