Skip to content

Commit db71614

Browse files
authored
Merge pull request #2413 from rspec/update-builds-for-6-1
Update builds for 6 1
2 parents fb55a77 + b5337fa commit db71614

File tree

4 files changed

+47
-14
lines changed

4 files changed

+47
-14
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,40 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
# Rails 6.1 builds >= 2.5
20-
- ruby: ruby-3.0.0-preview1
19+
# Rails Master builds >= 2.5
20+
- ruby: ruby-3.0.0-preview2
2121
allow_failure: true
2222
env:
2323
RAILS_VERSION: 'master'
2424
- ruby: 2.7.1
25+
allow_failure: true
2526
env:
2627
RAILS_VERSION: 'master'
2728
- ruby: 2.6.6
29+
allow_failure: true
2830
env:
2931
RAILS_VERSION: 'master'
3032
- ruby: 2.5.8
33+
allow_failure: true
3134
env:
3235
RAILS_VERSION: 'master'
3336

37+
# Rails 6.1.0 builds >= 2.5
38+
- ruby: ruby-3.0.0-preview2
39+
env:
40+
RAILS_VERSION: '~> 6.1.0'
41+
- ruby: 2.7.1
42+
env:
43+
RAILS_VERSION: '~> 6.1.0'
44+
- ruby: 2.6.6
45+
env:
46+
RAILS_VERSION: '~> 6.1.0'
47+
- ruby: 2.5.8
48+
env:
49+
RAILS_VERSION: '~> 6.1.0'
50+
3451
# Rails 6.0 builds >= 2.5.0
35-
- ruby: 3.0.0-preview1
52+
- ruby: 3.0.0-preview2
3653
env:
3754
RAILS_VERSION: '~> 6.0.0'
3855
- ruby: 2.7

example_app_generator/generate_action_mailer_specs.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@
1414
end
1515
end
1616
CODE
17-
gsub_file 'config/initializers/action_mailer.rb',
18-
/ExampleApp/,
19-
Rails.application.class.parent.to_s
17+
18+
rails_parent =
19+
if Rails.version.to_f >= 6.0
20+
Rails.application.class.module_parent.to_s
21+
else
22+
Rails.application.class.parent.to_s
23+
end
24+
25+
gsub_file 'config/initializers/action_mailer.rb', /ExampleApp/, rails_parent
2026

2127
copy_file 'spec/support/default_preview_path'
2228
chmod 'spec/support/default_preview_path', 0755
23-
gsub_file 'spec/support/default_preview_path',
24-
/ExampleApp/,
25-
Rails.application.class.parent.to_s
29+
gsub_file 'spec/support/default_preview_path', /ExampleApp/, rails_parent
30+
2631
if skip_active_record?
2732
comment_lines 'spec/support/default_preview_path', /active_record/
2833
comment_lines 'spec/support/default_preview_path', /active_storage/

features/controller_specs/anonymous_controller.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Feature: anonymous controller
101101
When I run `rspec spec`
102102
Then the examples should all pass
103103

104+
# Deprecated support removed in https://github.com/rails/rails/commit/d52d7739468153bd6cb7c629f60bd5cd7ebea3eb
105+
@rails_pre_6
104106
Scenario: Specify error handling in `ApplicationController` with render :file
105107
Given a file named "spec/controllers/application_controller_spec.rb" with:
106108
"""ruby

lib/rspec/rails/matchers/action_mailbox.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ def initialize(message)
2222
@inbound_email = create_inbound_email(message)
2323
end
2424

25-
def matches?(mailbox)
26-
@mailbox = mailbox
27-
@receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email)
25+
if defined?(::ApplicationMailbox) && ::ApplicationMailbox.router.respond_to?(:mailbox_for)
26+
def matches?(mailbox)
27+
@mailbox = mailbox
28+
@receiver = ApplicationMailbox.router.mailbox_for(inbound_email)
2829

29-
@receiver == @mailbox
30+
@receiver == @mailbox
31+
end
32+
else
33+
def matches?(mailbox)
34+
@mailbox = mailbox
35+
@receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email)
36+
37+
@receiver == @mailbox
38+
end
3039
end
3140

3241
def failure_message
@@ -41,7 +50,7 @@ def failure_message_when_negated
4150
"expected #{describe_inbound_email} not to route to #{mailbox}"
4251
end
4352

44-
private
53+
private
4554

4655
attr_reader :inbound_email, :mailbox, :receiver
4756

0 commit comments

Comments
 (0)