@@ -3,6 +3,7 @@ Feature: URL helpers in mailer examples
3
3
Mailer specs are marked by `:type => :mailer` or if you have set
4
4
`config.infer_spec_type_from_file_location!` by placing them in `spec/mailer`.
5
5
6
+ @rails_post_5
6
7
Scenario : using URL helpers with default options
7
8
Given a file named "config/initializers/mailer_defaults.rb" with:
8
9
"""ruby
@@ -21,6 +22,7 @@ Feature: URL helpers in mailer examples
21
22
When I run `rspec spec`
22
23
Then the examples should all pass
23
24
25
+ @rails_post_5
24
26
Scenario : using URL helpers without default options
25
27
Given a file named "config/initializers/mailer_defaults.rb" with:
26
28
"""ruby
@@ -39,3 +41,42 @@ Feature: URL helpers in mailer examples
39
41
"""
40
42
When I run `rspec spec`
41
43
Then the examples should all pass
44
+
45
+ @rails_pre_5
46
+ Scenario : using URL helpers with default options
47
+ Given a file named "config/initializers/mailer_defaults.rb" with:
48
+ """ruby
49
+ Rails.configuration.action_mailer.default_url_options = { :host => 'example.com' }
50
+ """
51
+ And a file named "spec/mailers/notifications_spec.rb" with:
52
+ """ruby
53
+ require 'rails_helper'
54
+
55
+ RSpec.describe Notifications, :type => :mailer do
56
+ it 'should have access to URL helpers' do
57
+ expect { gadgets_url }.not_to raise_error
58
+ end
59
+ end
60
+ """
61
+ When I run `rspec spec`
62
+ Then the examples should all pass
63
+
64
+ @rails_pre_5
65
+ Scenario : using URL helpers without default options
66
+ Given a file named "config/initializers/mailer_defaults.rb" with:
67
+ """ruby
68
+ # no default options
69
+ """
70
+ And a file named "spec/mailers/notifications_spec.rb" with:
71
+ """ruby
72
+ require 'rails_helper'
73
+
74
+ RSpec.describe Notifications, :type => :mailer do
75
+ it 'should have access to URL helpers' do
76
+ expect { gadgets_url :host => 'example.com' }.not_to raise_error
77
+ expect { gadgets_url }.to raise_error
78
+ end
79
+ end
80
+ """
81
+ When I run `rspec spec`
82
+ Then the examples should all pass
0 commit comments