From e83c996b0764f5bec0736ea45e9f6deedc3f1f4e Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Wed, 2 Dec 2020 12:55:50 +0100 Subject: [PATCH 1/4] Add 6.1.0 to matrix --- .github/workflows/ci.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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 From a90e52f1177205b1d32d9d3e997d8c947fed218c Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Wed, 4 Nov 2020 00:46:59 +0100 Subject: [PATCH 2/4] Use mailbox_for when available https://github.com/rails/rails/pull/36181 --- lib/rspec/rails/matchers/action_mailbox.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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 From d61f35b0d46e7e77e22c36d092c823a995f08f80 Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Sun, 1 Nov 2020 14:47:43 +0100 Subject: [PATCH 3/4] Skip test for deprecated support of relative paths to `render file:` --- features/controller_specs/anonymous_controller.feature | 2 ++ 1 file changed, 2 insertions(+) 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 From b5337fa5cf373ef169ce014d0303106f0db5e01c Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Fri, 11 Dec 2020 21:05:13 +0000 Subject: [PATCH 4/4] Replace deprecated parent method with module_parent --- .../generate_action_mailer_specs.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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/