forked from rspec/rspec-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailer_spec.feature
53 lines (45 loc) · 1.49 KB
/
mailer_spec.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Feature: mailer spec
@rails_post_5
Scenario: simple passing example
Given a file named "spec/mailers/notifications_mailer_spec.rb" with:
"""ruby
require "rails_helper"
RSpec.describe NotificationsMailer, :type => :mailer do
describe "notify" do
let(:mail) { NotificationsMailer.signup }
it "renders the headers" do
expect(mail.subject).to eq("Signup")
expect(mail.to).to eq(["[email protected]"])
expect(mail.from).to eq(["[email protected]"])
end
it "renders the body" do
expect(mail.body.encoded).to match("Hi")
end
end
end
"""
When I run `rspec spec`
Then the example should pass
@rails_pre_5
Scenario: using URL helpers without default options
Given a file named "config/initializers/mailer_defaults.rb" with:
"""ruby
# no default options
"""
And a file named "spec/mailers/notifications_spec.rb" with:
"""ruby
require 'rails_helper'
RSpec.describe Notifications, :type => :mailer do
let(:mail) { Notifications.signup }
it "renders the headers" do
expect(mail.subject).to eq("Signup")
expect(mail.to).to eq(["[email protected]"])
expect(mail.from).to eq(["[email protected]"])
end
it 'renders the body' do
expect(mail.body.encoded).to match("Hi")
end
end
"""
When I run `rspec spec`
Then the examples should all pass