shoulda-matchers 1.5.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/Gemfile.lock +2 -2
- data/NEWS.md +12 -0
- data/README.md +0 -11
- data/features/rails_integration.feature +6 -8
- data/gemfiles/3.0.gemfile.lock +2 -2
- data/gemfiles/3.1.gemfile.lock +2 -2
- data/gemfiles/3.2.gemfile.lock +2 -2
- data/lib/shoulda/matchers/action_controller.rb +0 -4
- data/lib/shoulda/matchers/active_model.rb +0 -2
- data/lib/shoulda/matchers/active_record.rb +0 -1
- data/lib/shoulda/matchers/integrations/rspec.rb +0 -8
- data/lib/shoulda/matchers/integrations/test_unit.rb +0 -23
- data/lib/shoulda/matchers/version.rb +1 -1
- data/shoulda-matchers.gemspec +1 -1
- data/spec/spec_helper.rb +0 -2
- data/spec/support/controller_builder.rb +0 -24
- metadata +19 -70
- data/lib/shoulda/matchers/action_controller/assign_to_matcher.rb +0 -130
- data/lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb +0 -83
- data/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb +0 -121
- data/lib/shoulda/matchers/action_mailer.rb +0 -22
- data/lib/shoulda/matchers/action_mailer/have_sent_email_matcher.rb +0 -260
- data/lib/shoulda/matchers/active_model/validate_format_of_matcher.rb +0 -108
- data/lib/shoulda/matchers/active_record/query_the_database_matcher.rb +0 -111
- data/lib/shoulda/matchers/independent.rb +0 -9
- data/lib/shoulda/matchers/independent/delegate_matcher.rb +0 -134
- data/spec/shoulda/matchers/action_controller/assign_to_matcher_spec.rb +0 -66
- data/spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb +0 -31
- data/spec/shoulda/matchers/action_controller/strong_parameters_matcher_spec.rb +0 -142
- data/spec/shoulda/matchers/action_mailer/have_sent_email_spec.rb +0 -324
- data/spec/shoulda/matchers/active_model/validate_format_of_matcher_spec.rb +0 -75
- data/spec/shoulda/matchers/active_record/query_the_database_matcher_spec.rb +0 -45
- data/spec/shoulda/matchers/independent/delegate_matcher_spec.rb +0 -204
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoulda::Matchers::ActionController do
|
4
|
-
describe ".permit" do
|
5
|
-
it "is true when the sent parameter is allowed" do
|
6
|
-
controller_class = controller_for_resource_with_strong_parameters do
|
7
|
-
params.require(:user).permit(:name)
|
8
|
-
end
|
9
|
-
|
10
|
-
controller_class.should permit(:name).for(:create)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "is false when the sent parameter is not allowed" do
|
14
|
-
controller_class = controller_for_resource_with_strong_parameters do
|
15
|
-
params.require(:user).permit(:name)
|
16
|
-
end
|
17
|
-
|
18
|
-
controller_class.should_not permit(:admin).for(:create)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "allows multiple attributes" do
|
22
|
-
controller_class = controller_for_resource_with_strong_parameters do
|
23
|
-
params.require(:user).permit(:name, :age)
|
24
|
-
end
|
25
|
-
|
26
|
-
controller_class.should permit(:name, :age).for(:create)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe Shoulda::Matchers::ActionController::StrongParametersMatcher do
|
32
|
-
before do
|
33
|
-
controller_for_resource_with_strong_parameters do
|
34
|
-
params.require(:user).permit(:name, :age)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#matches?" do
|
39
|
-
it "is true for a subset of the allowable attributes" do
|
40
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, self).for(:create)
|
41
|
-
matcher.matches?.should be_true
|
42
|
-
end
|
43
|
-
|
44
|
-
it "is true for all the allowable attributes" do
|
45
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :age, self).for(:create)
|
46
|
-
matcher.matches?.should be_true
|
47
|
-
end
|
48
|
-
|
49
|
-
it "is false when any attributes are not allowed" do
|
50
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :admin, self).for(:create)
|
51
|
-
matcher.matches?.should be_false
|
52
|
-
end
|
53
|
-
|
54
|
-
it "is false when permit is not called" do
|
55
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, self).for(:new, :verb => :get)
|
56
|
-
matcher.matches?.should be_false
|
57
|
-
end
|
58
|
-
|
59
|
-
it "requires an action" do
|
60
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, self)
|
61
|
-
expect{ matcher.matches? }.to raise_error(Shoulda::Matchers::ActionController::StrongParametersMatcher::ActionNotDefinedError)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "requires a verb for non-restful action" do
|
65
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, self).for(:authorize)
|
66
|
-
expect{ matcher.matches? }.to raise_error(Shoulda::Matchers::ActionController::StrongParametersMatcher::VerbNotDefinedError)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "#does_not_match?" do
|
71
|
-
it "it is true if any of the given attributes are allowed" do
|
72
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :admin, self).for(:create)
|
73
|
-
matcher.does_not_match?.should be_true
|
74
|
-
end
|
75
|
-
|
76
|
-
it "it is false if all of the given attribtues are allowed" do
|
77
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :age, self).for(:create)
|
78
|
-
matcher.does_not_match?.should be_false
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "#failure_message" do
|
83
|
-
it "includes all missing attributes" do
|
84
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :age, :city, :country, self).for(:create)
|
85
|
-
matcher.matches?
|
86
|
-
|
87
|
-
matcher.failure_message.should eq("Expected controller to permit city and country, but it did not.")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#negative_failure_message" do
|
92
|
-
it "includes all attributes that should not have been allowed but were" do
|
93
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, :age, :city, :country, self).for(:create)
|
94
|
-
matcher.does_not_match?.should be_true
|
95
|
-
|
96
|
-
matcher.negative_failure_message.should eq("Expected controller not to permit city and country, but it did.")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "#for" do
|
101
|
-
context "when given :create" do
|
102
|
-
it "posts to the controller" do
|
103
|
-
context = stub('context', :post => nil)
|
104
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, context).for(:create)
|
105
|
-
|
106
|
-
matcher.matches?
|
107
|
-
context.should have_received(:post).with(:create)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
context "when given :update" do
|
112
|
-
it "puts to the controller" do
|
113
|
-
context = stub('context', :put => nil)
|
114
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, context).for(:update)
|
115
|
-
|
116
|
-
matcher.matches?
|
117
|
-
context.should have_received(:put).with(:update)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "when given a custom action and verb" do
|
122
|
-
it "puts to the controller" do
|
123
|
-
context = stub('context', :delete => nil)
|
124
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, context).for(:hide, :verb => :delete)
|
125
|
-
|
126
|
-
matcher.matches?
|
127
|
-
context.should have_received(:delete).with(:hide)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe "#in_context" do
|
133
|
-
it 'sets the object the controller action is sent to' do
|
134
|
-
context = stub('context', :post => nil)
|
135
|
-
matcher = Shoulda::Matchers::ActionController::StrongParametersMatcher.new(:name, nil).for(:create).in_context(context)
|
136
|
-
|
137
|
-
matcher.matches?
|
138
|
-
|
139
|
-
context.should have_received(:post).with(:create)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
@@ -1,324 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoulda::Matchers::ActionMailer::HaveSentEmailMatcher do
|
4
|
-
subject { described_class.new(self) }
|
5
|
-
after { ::ActionMailer::Base.deliveries.clear }
|
6
|
-
|
7
|
-
def add_mail_to_deliveries(params = nil)
|
8
|
-
::ActionMailer::Base.deliveries << Mailer.the_email(params)
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'testing with instance variables with no multipart' do
|
12
|
-
let(:info) do
|
13
|
-
{
|
14
|
-
:from => 'do-not-reply@example.com',
|
15
|
-
:reply_to => 'reply-to-me@example.com',
|
16
|
-
:to => 'myself@me.com',
|
17
|
-
:cc => ['you@you.com', 'joe@bob.com', 'hello@goodbye.com'],
|
18
|
-
:bcc => ['test@example.com', 'sam@bob.com', 'goodbye@hello.com'],
|
19
|
-
:subject => 'This is spam',
|
20
|
-
:body => 'Every email is spam.'
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
before do
|
25
|
-
define_mailer(:mailer, [:the_email]) do
|
26
|
-
def the_email(params)
|
27
|
-
mail params
|
28
|
-
end
|
29
|
-
end
|
30
|
-
add_mail_to_deliveries(info)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'sends an e-mail based on subject' do
|
34
|
-
should have_sent_email.with_subject{ info[:subject] }
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'sends an e-mail based on recipient' do
|
38
|
-
should have_sent_email.to(nil) { info[:to] }
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'sends an e-mail based on sender' do
|
42
|
-
should have_sent_email.from{ info[:from] }
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'sends an e-email based on reply_to' do
|
46
|
-
should have_sent_email.reply_to { info[:reply_to] }
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'sends an e-mail based on cc' do
|
50
|
-
should have_sent_email.cc{ info[:cc][0] }
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'sends an e-mail based on cc list' do
|
54
|
-
should have_sent_email.with_cc{ info[:cc] }
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'sends an e-mail based on bcc' do
|
58
|
-
should have_sent_email.bcc{ info[:bcc][0] }
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'sends an e-mail based on bcc list' do
|
62
|
-
should have_sent_email.with_bcc{ info[:bcc] }
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'sends an e-mail based on body' do
|
66
|
-
should have_sent_email.with_body{ info[:body] }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'testing with instance variables with multiple parts' do
|
71
|
-
let(:info) do
|
72
|
-
{
|
73
|
-
:from => 'do-not-reply@example.com',
|
74
|
-
:to => 'myself@me.com',
|
75
|
-
:cc => ['you@you.com', 'joe@bob.com', 'hello@goodbye.com'],
|
76
|
-
:bcc => ['test@example.com', 'sam@bob.com', 'goodbye@hello.com'],
|
77
|
-
:subject => 'This is spam',
|
78
|
-
:text => 'Every email is spam.',
|
79
|
-
:html => '<h1>HTML is spam.</h1><p>Notably.</p>'
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
before do
|
84
|
-
define_mailer(:mailer, [:the_email]) do
|
85
|
-
def the_email(params)
|
86
|
-
mail params do |format|
|
87
|
-
format.text { render :text => params[:text] }
|
88
|
-
format.html { render :text => params[:html] }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
add_mail_to_deliveries(info)
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'sends emails with text and html parts' do
|
96
|
-
should have_sent_email.with_part('text/plain') { info[:text] }.with_part('text/html') { info[:html] }
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should have the block override the method argument' do
|
100
|
-
should have_sent_email.with_part('text/plain', 'foo') { info[:text] }.with_part('text/html', /bar/) { info[:html] }
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
context 'an email without multiple parts' do
|
105
|
-
before do
|
106
|
-
define_mailer :mailer, [:the_email] do
|
107
|
-
def the_email(params)
|
108
|
-
mail :from => 'do-not-reply@example.com',
|
109
|
-
:to => 'myself@me.com',
|
110
|
-
:subject => 'This is spam',
|
111
|
-
:cc => ['you@you.com', 'joe@bob.com', 'hello@goodbye.com'],
|
112
|
-
:bcc => ['test@example.com', 'sam@bob.com', 'goodbye@hello.com'],
|
113
|
-
:body => 'Every email is spam.'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
add_mail_to_deliveries
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'accepts sent-email when it is not multipart' do
|
120
|
-
should_not have_sent_email.multipart
|
121
|
-
matcher = have_sent_email.multipart(true)
|
122
|
-
matcher.matches?(Mailer.the_email(nil))
|
123
|
-
matcher.failure_message_for_should.should =~ /Expected sent email being multipart/
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'matches the body with a regexp' do
|
127
|
-
should have_sent_email.with_body(/email is spam/)
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'matches the body with a string' do
|
131
|
-
should have_sent_email.with_body('Every email is spam.')
|
132
|
-
should_not have_sent_email.with_body('emails is')
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
context 'an email with both a text/plain and text/html part' do
|
137
|
-
before do
|
138
|
-
define_mailer :mailer, [:the_email] do
|
139
|
-
def the_email(params)
|
140
|
-
mail :from => 'do-not-reply@example.com',
|
141
|
-
:to => 'myself@me.com',
|
142
|
-
:cc => ['you@you.com', 'joe@bob.com', 'hello@goodbye.com'],
|
143
|
-
:bcc => ['test@example.com', 'sam@bob.com', 'goodbye@hello.com'],
|
144
|
-
:subject => 'This is spam' do |format|
|
145
|
-
|
146
|
-
format.text { render :text => 'Every email is spam.' }
|
147
|
-
format.html { render :text => '<h1>HTML is spam.</h1><p>Notably.</p>' }
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
add_mail_to_deliveries
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'accepts sent e-mail based on the subject' do
|
155
|
-
should have_sent_email.with_subject(/is spam$/)
|
156
|
-
matcher = have_sent_email.with_subject(/totally safe/)
|
157
|
-
matcher.matches?(nil)
|
158
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with subject/
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'accepts sent e-mail based on a string sender' do
|
162
|
-
should have_sent_email.from('do-not-reply@example.com')
|
163
|
-
matcher = have_sent_email.from('you@example.com')
|
164
|
-
matcher.matches?(nil)
|
165
|
-
matcher.failure_message_for_should.should =~ /Expected sent email from/
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'accepts sent e-mail based on a regexp sender' do
|
169
|
-
should have_sent_email.from(/@example\.com/)
|
170
|
-
matcher = have_sent_email.from(/you@/)
|
171
|
-
matcher.matches?(nil)
|
172
|
-
matcher.failure_message_for_should.should =~ /Expected sent email from/
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'accepts sent e-mail based on the body' do
|
176
|
-
should have_sent_email.with_body(/is spam\./)
|
177
|
-
matcher = have_sent_email.with_body(/totally safe/)
|
178
|
-
matcher.matches?(nil)
|
179
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with body/
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'accepts sent e-mail based on a text/plain part' do
|
183
|
-
should have_sent_email.with_part('text/plain', /is spam\./)
|
184
|
-
matcher = have_sent_email.with_part('text/plain', /HTML is spam/)
|
185
|
-
matcher.matches?(nil)
|
186
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with a text\/plain part containing/
|
187
|
-
end
|
188
|
-
|
189
|
-
it 'accepts sent e-mail based on a text/html part' do
|
190
|
-
should have_sent_email.with_part('text/html', /HTML is spam/)
|
191
|
-
matcher = have_sent_email.with_part('text/html', /HTML is not spam\./)
|
192
|
-
matcher.matches?(nil)
|
193
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with a text\/html part containing/
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'accept sent e-mail based on the recipient' do
|
197
|
-
should have_sent_email.to('myself@me.com')
|
198
|
-
matcher = have_sent_email.to('you@example.com')
|
199
|
-
matcher.matches?(nil)
|
200
|
-
matcher.failure_message_for_should.should =~ /Expected sent email to/
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'accepts sent e-mail based on cc string' do
|
204
|
-
should have_sent_email.cc('joe@bob.com')
|
205
|
-
matcher = have_sent_email.cc('you@example.com')
|
206
|
-
matcher.matches?(nil)
|
207
|
-
matcher.failure_message_for_should.should =~ /Expected sent email cc/
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'accepts sent-email based on cc regex' do
|
211
|
-
should have_sent_email.cc(/@bob\.com/)
|
212
|
-
matcher = have_sent_email.cc(/us@/)
|
213
|
-
matcher.matches?(nil)
|
214
|
-
matcher.failure_message_for_should.should =~ /Expected sent email cc/
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'accepts sent e-mail based on cc list' do
|
218
|
-
should have_sent_email.with_cc(['you@you.com', 'joe@bob.com'])
|
219
|
-
matcher = have_sent_email.with_cc(['you@example.com'])
|
220
|
-
matcher.matches?(nil)
|
221
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with cc/
|
222
|
-
end
|
223
|
-
|
224
|
-
it 'accepts sent e-mail based on bcc string' do
|
225
|
-
should have_sent_email.bcc('goodbye@hello.com')
|
226
|
-
matcher = have_sent_email.bcc('test@hello.com')
|
227
|
-
matcher.matches?(nil)
|
228
|
-
matcher.failure_message_for_should.should =~ /Expected sent email bcc/
|
229
|
-
end
|
230
|
-
|
231
|
-
it 'accepts sent e-mail based on bcc regex' do
|
232
|
-
should have_sent_email.bcc(/@example\.com/)
|
233
|
-
matcher = have_sent_email.bcc(/you@/)
|
234
|
-
matcher.matches?(nil)
|
235
|
-
matcher.failure_message_for_should.should =~ /Expected sent email bcc/
|
236
|
-
end
|
237
|
-
|
238
|
-
it 'accepts sent e-mail based on bcc list' do
|
239
|
-
should have_sent_email.with_bcc(['sam@bob.com', 'test@example.com'])
|
240
|
-
matcher = have_sent_email.with_bcc(['you@you.com', 'joe@bob.com'])
|
241
|
-
matcher.matches?(nil)
|
242
|
-
matcher.failure_message_for_should.should =~ /Expected sent email with bcc/
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'accepts sent-email when it is multipart' do
|
246
|
-
should have_sent_email.multipart
|
247
|
-
matcher = have_sent_email.multipart(false)
|
248
|
-
matcher.matches?(nil)
|
249
|
-
matcher.failure_message_for_should.should =~ /Expected sent email not being multipart/
|
250
|
-
end
|
251
|
-
|
252
|
-
it 'lists all the deliveries within failure message' do
|
253
|
-
add_mail_to_deliveries
|
254
|
-
|
255
|
-
matcher = have_sent_email.to('you@example.com')
|
256
|
-
matcher.matches?(nil)
|
257
|
-
matcher.failure_message_for_should.should =~ /Deliveries:\n"This is spam" to \["myself@me\.com"\]\n"This is spam" to \["myself@me\.com"\]/
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'allows chaining' do
|
261
|
-
should have_sent_email.with_subject(/spam/).from('do-not-reply@example.com').with_body(/spam/).
|
262
|
-
with_part('text/plain', /is spam\./).with_part('text/html', /HTML is spam/).to('myself@me.com')
|
263
|
-
should_not have_sent_email.with_subject(/ham/).from('you@example.com').with_body(/ham/).
|
264
|
-
with_part('text/plain', /is ham/).with_part('text/html', /HTML is ham/).to('them@example.com')
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
context 'testing multiple email deliveries at once' do
|
269
|
-
let(:info1) do
|
270
|
-
{
|
271
|
-
:from => 'do-not-reply@example.com',
|
272
|
-
:to => 'one@me.com',
|
273
|
-
:subject => 'subject',
|
274
|
-
:body => 'body'
|
275
|
-
}
|
276
|
-
end
|
277
|
-
|
278
|
-
let(:info2) do
|
279
|
-
{
|
280
|
-
:from => 'do-not-reply@example.com',
|
281
|
-
:to => 'two@me.com',
|
282
|
-
:subject => 'subject',
|
283
|
-
:body => 'body'
|
284
|
-
}
|
285
|
-
end
|
286
|
-
|
287
|
-
before do
|
288
|
-
define_mailer(:mailer, [:the_email]) do
|
289
|
-
def the_email(params)
|
290
|
-
mail params
|
291
|
-
end
|
292
|
-
end
|
293
|
-
add_mail_to_deliveries(info1)
|
294
|
-
add_mail_to_deliveries(info2)
|
295
|
-
end
|
296
|
-
|
297
|
-
it 'sends an e-mail based on recipient 1' do
|
298
|
-
should have_sent_email.to('one@me.com')
|
299
|
-
end
|
300
|
-
|
301
|
-
it 'sends an e-mail based on recipient 2' do
|
302
|
-
should have_sent_email.to('two@me.com')
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
it 'provides a detailed description of the e-mail expected to be sent' do
|
307
|
-
matcher = have_sent_email
|
308
|
-
matcher.description.should == 'send an email'
|
309
|
-
matcher = matcher.with_subject('Welcome!')
|
310
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!")
|
311
|
-
matcher = matcher.with_body('Welcome, human!')
|
312
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!")
|
313
|
-
matcher = matcher.with_part("text/plain", "plain")
|
314
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!" having a text/plain part containing "plain")
|
315
|
-
matcher = matcher.with_part('text/html', 'html')
|
316
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!" having a text/plain part containing "plain" having a text/html part containing "html")
|
317
|
-
matcher = matcher.from('alien@example.com')
|
318
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!" having a text/plain part containing "plain" having a text/html part containing "html" from "alien@example.com")
|
319
|
-
matcher = matcher.to('human@example.com')
|
320
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!" having a text/plain part containing "plain" having a text/html part containing "html" from "alien@example.com" to "human@example.com")
|
321
|
-
matcher = matcher.reply_to('reply-to-me@example.com')
|
322
|
-
matcher.description.should == %q(send an email with a subject of "Welcome!" containing "Welcome, human!" having a text/plain part containing "plain" having a text/html part containing "html" from "alien@example.com" reply to "reply-to-me@example.com" to "human@example.com")
|
323
|
-
end
|
324
|
-
end
|