Skip to content

Commit

Permalink
Merge pull request #2413 from rspec/update-builds-for-6-1
Browse files Browse the repository at this point in the history
Update builds for 6 1
  • Loading branch information
JonRowe authored Dec 11, 2020
2 parents fb55a77 + b5337fa commit db71614
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions example_app_generator/generate_action_mailer_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 2 additions & 0 deletions features/controller_specs/anonymous_controller.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions lib/rspec/rails/matchers/action_mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit db71614

Please sign in to comment.