diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac2b0bd7b4..db17fd9242 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,23 +16,40 @@ jobs: fail-fast: false matrix: include: - # Rails 6.1 builds >= 2.5 - - ruby: ruby-3.0.0-preview1 + # Rails Master builds >= 2.5 + - ruby: ruby-3.0.0-preview2 allow_failure: true env: RAILS_VERSION: 'master' - ruby: 2.7.1 + allow_failure: true env: RAILS_VERSION: 'master' - ruby: 2.6.6 + allow_failure: true env: RAILS_VERSION: 'master' - ruby: 2.5.8 + allow_failure: true env: RAILS_VERSION: 'master' + # Rails 6.1.0 builds >= 2.5 + - ruby: ruby-3.0.0-preview2 + env: + RAILS_VERSION: '~> 6.1.0' + - ruby: 2.7.1 + env: + RAILS_VERSION: '~> 6.1.0' + - ruby: 2.6.6 + env: + RAILS_VERSION: '~> 6.1.0' + - ruby: 2.5.8 + env: + RAILS_VERSION: '~> 6.1.0' + # Rails 6.0 builds >= 2.5.0 - - ruby: 3.0.0-preview1 + - ruby: 3.0.0-preview2 env: RAILS_VERSION: '~> 6.0.0' - ruby: 2.7 diff --git a/example_app_generator/generate_action_mailer_specs.rb b/example_app_generator/generate_action_mailer_specs.rb index 13a1f0a4c0..06833fc1a5 100644 --- a/example_app_generator/generate_action_mailer_specs.rb +++ b/example_app_generator/generate_action_mailer_specs.rb @@ -14,15 +14,20 @@ end end CODE - gsub_file 'config/initializers/action_mailer.rb', - /ExampleApp/, - Rails.application.class.parent.to_s + + rails_parent = + if Rails.version.to_f >= 6.0 + Rails.application.class.module_parent.to_s + else + Rails.application.class.parent.to_s + end + + gsub_file 'config/initializers/action_mailer.rb', /ExampleApp/, rails_parent copy_file 'spec/support/default_preview_path' chmod 'spec/support/default_preview_path', 0755 - gsub_file 'spec/support/default_preview_path', - /ExampleApp/, - Rails.application.class.parent.to_s + gsub_file 'spec/support/default_preview_path', /ExampleApp/, rails_parent + if skip_active_record? comment_lines 'spec/support/default_preview_path', /active_record/ comment_lines 'spec/support/default_preview_path', /active_storage/ diff --git a/features/controller_specs/anonymous_controller.feature b/features/controller_specs/anonymous_controller.feature index 7892b4dfac..9baf73fb8d 100644 --- a/features/controller_specs/anonymous_controller.feature +++ b/features/controller_specs/anonymous_controller.feature @@ -101,6 +101,8 @@ Feature: anonymous controller When I run `rspec spec` Then the examples should all pass + # Deprecated support removed in https://github.com/rails/rails/commit/d52d7739468153bd6cb7c629f60bd5cd7ebea3eb + @rails_pre_6 Scenario: Specify error handling in `ApplicationController` with render :file Given a file named "spec/controllers/application_controller_spec.rb" with: """ruby diff --git a/lib/rspec/rails/matchers/action_mailbox.rb b/lib/rspec/rails/matchers/action_mailbox.rb index c5392cb225..de50c69143 100644 --- a/lib/rspec/rails/matchers/action_mailbox.rb +++ b/lib/rspec/rails/matchers/action_mailbox.rb @@ -22,11 +22,20 @@ def initialize(message) @inbound_email = create_inbound_email(message) end - def matches?(mailbox) - @mailbox = mailbox - @receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email) + if defined?(::ApplicationMailbox) && ::ApplicationMailbox.router.respond_to?(:mailbox_for) + def matches?(mailbox) + @mailbox = mailbox + @receiver = ApplicationMailbox.router.mailbox_for(inbound_email) - @receiver == @mailbox + @receiver == @mailbox + end + else + def matches?(mailbox) + @mailbox = mailbox + @receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email) + + @receiver == @mailbox + end end def failure_message @@ -41,7 +50,7 @@ def failure_message_when_negated "expected #{describe_inbound_email} not to route to #{mailbox}" end - private + private attr_reader :inbound_email, :mailbox, :receiver