File tree Expand file tree Collapse file tree 4 files changed +47
-14
lines changed
features/controller_specs Expand file tree Collapse file tree 4 files changed +47
-14
lines changed Original file line number Diff line number Diff line change @@ -16,23 +16,40 @@ jobs:
16
16
fail-fast : false
17
17
matrix :
18
18
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
21
21
allow_failure : true
22
22
env :
23
23
RAILS_VERSION : ' master'
24
24
- ruby : 2.7.1
25
+ allow_failure : true
25
26
env :
26
27
RAILS_VERSION : ' master'
27
28
- ruby : 2.6.6
29
+ allow_failure : true
28
30
env :
29
31
RAILS_VERSION : ' master'
30
32
- ruby : 2.5.8
33
+ allow_failure : true
31
34
env :
32
35
RAILS_VERSION : ' master'
33
36
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
+
34
51
# Rails 6.0 builds >= 2.5.0
35
- - ruby : 3.0.0-preview1
52
+ - ruby : 3.0.0-preview2
36
53
env :
37
54
RAILS_VERSION : ' ~> 6.0.0'
38
55
- ruby : 2.7
Original file line number Diff line number Diff line change 14
14
end
15
15
end
16
16
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
20
26
21
27
copy_file 'spec/support/default_preview_path'
22
28
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
+
26
31
if skip_active_record?
27
32
comment_lines 'spec/support/default_preview_path' , /active_record/
28
33
comment_lines 'spec/support/default_preview_path' , /active_storage/
Original file line number Diff line number Diff line change @@ -101,6 +101,8 @@ Feature: anonymous controller
101
101
When I run `rspec spec`
102
102
Then the examples should all pass
103
103
104
+ # Deprecated support removed in https://github.com/rails/rails/commit/d52d7739468153bd6cb7c629f60bd5cd7ebea3eb
105
+ @rails_pre_6
104
106
Scenario : Specify error handling in `ApplicationController` with render :file
105
107
Given a file named "spec/controllers/application_controller_spec.rb" with:
106
108
"""ruby
Original file line number Diff line number Diff line change @@ -22,11 +22,20 @@ def initialize(message)
22
22
@inbound_email = create_inbound_email ( message )
23
23
end
24
24
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 )
28
29
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
30
39
end
31
40
32
41
def failure_message
@@ -41,7 +50,7 @@ def failure_message_when_negated
41
50
"expected #{ describe_inbound_email } not to route to #{ mailbox } "
42
51
end
43
52
44
- private
53
+ private
45
54
46
55
attr_reader :inbound_email , :mailbox , :receiver
47
56
You can’t perform that action at this time.
0 commit comments