mailgun 0.8 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +13 -0
- data/CONTRIBUTORS.md +5 -1
- data/README.md +39 -2
- data/lib/mailgun.rb +6 -1
- data/lib/mailgun/address.rb +20 -0
- data/lib/mailgun/base.rb +45 -16
- data/lib/mailgun/client.rb +87 -0
- data/lib/mailgun/domain.rb +9 -4
- data/lib/mailgun/list/member.rb +9 -1
- data/lib/mailgun/mailgun_error.rb +54 -1
- data/lib/mailgun/route.rb +9 -4
- data/lib/mailgun/secure.rb +30 -0
- data/lib/mailgun/webhook.rb +55 -0
- data/lib/multimap/spec/enumerable_examples.rb +22 -22
- data/lib/multimap/spec/hash_examples.rb +88 -88
- data/lib/multimap/spec/multiset_spec.rb +62 -62
- data/lib/multimap/spec/nested_multimap_spec.rb +58 -58
- data/lib/multimap/spec/set_examples.rb +112 -112
- data/lib/multimap/spec/spec_helper.rb +2 -2
- data/mailgun.gemspec +3 -5
- data/spec/address_spec.rb +27 -0
- data/spec/base_spec.rb +31 -25
- data/spec/bounce_spec.rb +5 -5
- data/spec/client_spec.rb +118 -0
- data/spec/complaint_spec.rb +4 -4
- data/spec/domain_spec.rb +17 -5
- data/spec/helpers/mailgun_helper.rb +9 -0
- data/spec/list/member_spec.rb +7 -7
- data/spec/list/message_spec.rb +3 -3
- data/spec/list_spec.rb +6 -6
- data/spec/log_spec.rb +2 -2
- data/spec/mailbox_spec.rb +4 -4
- data/spec/route_spec.rb +10 -11
- data/spec/secure_spec.rb +55 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unsubscribe_spec.rb +6 -6
- data/spec/webhook_spec.rb +115 -0
- metadata +22 -21
@@ -4,16 +4,16 @@ shared_examples_for Set do
|
|
4
4
|
Multiset[nil]
|
5
5
|
Multiset[1, 2, 3]
|
6
6
|
|
7
|
-
Multiset[].size.
|
8
|
-
Multiset[nil].size.
|
9
|
-
Multiset[[]].size.
|
10
|
-
Multiset[[nil]].size.
|
7
|
+
expect(Multiset[].size).to eql(0)
|
8
|
+
expect(Multiset[nil].size).to eql(1)
|
9
|
+
expect(Multiset[[]].size).to eql(1)
|
10
|
+
expect(Multiset[[nil]].size).to eql(1)
|
11
11
|
|
12
12
|
set = Multiset[2, 4, 6, 4]
|
13
|
-
Multiset.new([2, 4, 6]).
|
13
|
+
expect(Multiset.new([2, 4, 6])).to_not eql(set)
|
14
14
|
|
15
15
|
set = Multiset[2, 4, 6, 4]
|
16
|
-
Multiset.new([2, 4, 6, 4]).
|
16
|
+
expect(Multiset.new([2, 4, 6, 4])).to eql(set)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should create a new set containing the elements of the given enumerable object" do
|
@@ -23,247 +23,247 @@ shared_examples_for Set do
|
|
23
23
|
Multiset.new([1, 2])
|
24
24
|
Multiset.new('a'..'c')
|
25
25
|
|
26
|
-
lambda { Multiset.new(false) }.
|
27
|
-
lambda { Multiset.new(1) }.
|
28
|
-
lambda { Multiset.new(1, 2) }.
|
26
|
+
expect(lambda { Multiset.new(false) }).to raise_error
|
27
|
+
expect(lambda { Multiset.new(1) }).to raise_error
|
28
|
+
expect(lambda { Multiset.new(1, 2) }).to raise_error
|
29
29
|
|
30
|
-
Multiset.new().size.
|
31
|
-
Multiset.new(nil).size.
|
32
|
-
Multiset.new([]).size.
|
33
|
-
Multiset.new([nil]).size.
|
30
|
+
expect(Multiset.new().size).to eql(0)
|
31
|
+
expect(Multiset.new(nil).size).to eql(0)
|
32
|
+
expect(Multiset.new([]).size).to eql(0)
|
33
|
+
expect(Multiset.new([nil]).size).to eql(1)
|
34
34
|
|
35
35
|
ary = [2, 4, 6, 4]
|
36
36
|
set = Multiset.new(ary)
|
37
37
|
ary.clear
|
38
|
-
set.
|
39
|
-
set.size.
|
38
|
+
expect(set).to_not be_empty
|
39
|
+
expect(set.size).to eql(4)
|
40
40
|
|
41
41
|
ary = [1, 2, 3]
|
42
42
|
|
43
43
|
s = Multiset.new(ary) { |o| o * 2 }
|
44
|
-
[2, 4, 6].
|
44
|
+
expect([2, 4, 6]).to eql(s.sort)
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should duplicate set" do
|
48
48
|
set1 = Multiset[1, 2]
|
49
49
|
set2 = set1.dup
|
50
50
|
|
51
|
-
set1.
|
51
|
+
expect(set1).to_not equal(set2)
|
52
52
|
|
53
|
-
set1.
|
53
|
+
expect(set1).to eql(set2)
|
54
54
|
|
55
55
|
set1.add(3)
|
56
56
|
|
57
|
-
set1.
|
57
|
+
expect(set1).to_not eql(set2)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should return the number of elements" do
|
61
|
-
Multiset[].size.
|
62
|
-
Multiset[1, 2].size.
|
63
|
-
Multiset[1, 2, 1].size.
|
61
|
+
expect(Multiset[].size).to eql(0)
|
62
|
+
expect(Multiset[1, 2].size).to eql(2)
|
63
|
+
expect(Multiset[1, 2, 1].size).to eql(3)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should return true if the set contains no elements" do
|
67
|
-
Multiset[].
|
68
|
-
Multiset[1, 2].
|
67
|
+
expect(Multiset[]).to be_empty
|
68
|
+
expect(Multiset[1, 2]).to_not be_empty
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should remove all elements and returns self" do
|
72
72
|
set = Multiset[1, 2]
|
73
73
|
ret = set.clear
|
74
74
|
|
75
|
-
set.
|
76
|
-
set.
|
75
|
+
expect(set).to equal(ret)
|
76
|
+
expect(set).to be_empty
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should replaces the contents of the set with the contents of the given enumerable object and returns self" do
|
80
80
|
set = Multiset[1, 2]
|
81
81
|
ret = set.replace('a'..'c')
|
82
82
|
|
83
|
-
set.
|
84
|
-
set.
|
83
|
+
expect(set).to equal(ret)
|
84
|
+
expect(set).to eql(Multiset['a', 'b', 'c'])
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should convert the set to an array" do
|
88
88
|
set = Multiset[1, 2, 3, 2]
|
89
89
|
ary = set.to_a
|
90
90
|
|
91
|
-
ary.sort.
|
91
|
+
expect(ary.sort).to eql([1, 2, 2, 3])
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should return true if the set contains the given object" do
|
95
95
|
set = Multiset[1, 2, 3]
|
96
96
|
|
97
|
-
set.include?(1).
|
98
|
-
set.include?(2).
|
99
|
-
set.include?(3).
|
100
|
-
set.include?(0).
|
101
|
-
set.include?(nil).
|
97
|
+
expect(set.include?(1)).to be_true
|
98
|
+
expect(set.include?(2)).to be_true
|
99
|
+
expect(set.include?(3)).to be_true
|
100
|
+
expect(set.include?(0)).to be_false
|
101
|
+
expect(set.include?(nil)).to be_false
|
102
102
|
|
103
103
|
set = Multiset["1", nil, "2", nil, "0", "1", false]
|
104
|
-
set.include?(nil).
|
105
|
-
set.include?(false).
|
106
|
-
set.include?("1").
|
107
|
-
set.include?(0).
|
108
|
-
set.include?(true).
|
104
|
+
expect(set.include?(nil)).to be_true
|
105
|
+
expect(set.include?(false)).to be_true
|
106
|
+
expect(set.include?("1")).to be_true
|
107
|
+
expect(set.include?(0)).to be_false
|
108
|
+
expect(set.include?(true)).to be_false
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should return true if the set is a superset of the given set" do
|
112
112
|
set = Multiset[1, 2, 3]
|
113
113
|
|
114
|
-
lambda { set.superset?() }.
|
115
|
-
lambda { set.superset?(2) }.
|
116
|
-
lambda { set.superset?([2]) }.
|
114
|
+
expect(lambda { set.superset?() }).to raise_error
|
115
|
+
expect(lambda { set.superset?(2) }).to raise_error
|
116
|
+
expect(lambda { set.superset?([2]) }).to raise_error
|
117
117
|
|
118
|
-
set.superset?(Multiset[]).
|
119
|
-
set.superset?(Multiset[1, 2]).
|
120
|
-
set.superset?(Multiset[1, 2, 3]).
|
121
|
-
set.superset?(Multiset[1, 2, 3, 4]).
|
122
|
-
set.superset?(Multiset[1, 4]).
|
118
|
+
expect(set.superset?(Multiset[])).to be_true
|
119
|
+
expect(set.superset?(Multiset[1, 2])).to be_true
|
120
|
+
expect(set.superset?(Multiset[1, 2, 3])).to be_true
|
121
|
+
expect(set.superset?(Multiset[1, 2, 3, 4])).to be_false
|
122
|
+
expect(set.superset?(Multiset[1, 4])).to be_false
|
123
123
|
|
124
|
-
Multiset[].superset?(Multiset[]).
|
124
|
+
expect(Multiset[].superset?(Multiset[])).to be_true
|
125
125
|
end
|
126
126
|
|
127
127
|
it "should return true if the set is a proper superset of the given set" do
|
128
128
|
set = Multiset[1, 2, 3]
|
129
129
|
|
130
|
-
lambda { set.proper_superset?() }.
|
131
|
-
lambda { set.proper_superset?(2) }.
|
132
|
-
lambda { set.proper_superset?([2]) }.
|
130
|
+
expect(lambda { set.proper_superset?() }).to raise_error
|
131
|
+
expect(lambda { set.proper_superset?(2) }).to raise_error
|
132
|
+
expect(lambda { set.proper_superset?([2]) }).to raise_error
|
133
133
|
|
134
|
-
set.proper_superset?(Multiset[]).
|
135
|
-
set.proper_superset?(Multiset[1, 2]).
|
136
|
-
set.proper_superset?(Multiset[1, 2, 3]).
|
137
|
-
set.proper_superset?(Multiset[1, 2, 3, 4]).
|
138
|
-
set.proper_superset?(Multiset[1, 4]).
|
134
|
+
expect(set.proper_superset?(Multiset[])).to be_true
|
135
|
+
expect(set.proper_superset?(Multiset[1, 2])).to be_true
|
136
|
+
expect(set.proper_superset?(Multiset[1, 2, 3])).to be_false
|
137
|
+
expect(set.proper_superset?(Multiset[1, 2, 3, 4])).to be_false
|
138
|
+
expect(set.proper_superset?(Multiset[1, 4])).to be_false
|
139
139
|
|
140
|
-
Multiset[].proper_superset?(Multiset[]).
|
140
|
+
expect(Multiset[].proper_superset?(Multiset[])).to be_false
|
141
141
|
end
|
142
142
|
|
143
143
|
it "should return true if the set is a subset of the given set" do
|
144
144
|
set = Multiset[1, 2, 3]
|
145
145
|
|
146
|
-
lambda { set.subset?() }.
|
147
|
-
lambda { set.subset?(2) }.
|
148
|
-
lambda { set.subset?([2]) }.
|
146
|
+
expect(lambda { set.subset?() }).to raise_error
|
147
|
+
expect(lambda { set.subset?(2) }).to raise_error
|
148
|
+
expect(lambda { set.subset?([2]) }).to raise_error
|
149
149
|
|
150
|
-
set.subset?(Multiset[1, 2, 3, 4]).
|
151
|
-
set.subset?(Multiset[1, 2, 3]).
|
152
|
-
set.subset?(Multiset[1, 2]).
|
153
|
-
set.subset?(Multiset[]).
|
150
|
+
expect(set.subset?(Multiset[1, 2, 3, 4])).to be_true
|
151
|
+
expect(set.subset?(Multiset[1, 2, 3])).to be_true
|
152
|
+
expect(set.subset?(Multiset[1, 2])).to be_false
|
153
|
+
expect(set.subset?(Multiset[])).to be_false
|
154
154
|
|
155
|
-
Multiset[].subset?(Multiset[1]).
|
156
|
-
Multiset[].subset?(Multiset[]).
|
155
|
+
expect(Multiset[].subset?(Multiset[1])).to be_true
|
156
|
+
expect(Multiset[].subset?(Multiset[])).to be_true
|
157
157
|
end
|
158
158
|
|
159
159
|
it "should return true if the set is a proper subset of the given set" do
|
160
160
|
set = Multiset[1, 2, 3]
|
161
161
|
|
162
|
-
lambda { set.proper_subset?() }.
|
163
|
-
lambda { set.proper_subset?(2) }.
|
164
|
-
lambda { set.proper_subset?([2]) }.
|
162
|
+
expect(lambda { set.proper_subset?() }).to raise_error
|
163
|
+
expect(lambda { set.proper_subset?(2) }).to raise_error
|
164
|
+
expect(lambda { set.proper_subset?([2]) }).to raise_error
|
165
165
|
|
166
|
-
set.proper_subset?(Multiset[1, 2, 3, 4]).
|
167
|
-
set.proper_subset?(Multiset[1, 2, 3]).
|
168
|
-
set.proper_subset?(Multiset[1, 2]).
|
169
|
-
set.proper_subset?(Multiset[]).
|
166
|
+
expect(set.proper_subset?(Multiset[1, 2, 3, 4])).to be_true
|
167
|
+
expect(set.proper_subset?(Multiset[1, 2, 3])).to be_false
|
168
|
+
expect(set.proper_subset?(Multiset[1, 2])).to be_false
|
169
|
+
expect(set.proper_subset?(Multiset[])).to be_false
|
170
170
|
|
171
|
-
Multiset[].proper_subset?(Multiset[]).
|
171
|
+
expect(Multiset[].proper_subset?(Multiset[])).to be_false
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should add the given object to the set and return self" do
|
175
175
|
set = Multiset[1, 2, 3]
|
176
176
|
|
177
177
|
ret = set.add(2)
|
178
|
-
set.
|
179
|
-
set.
|
178
|
+
expect(set).to equal(ret)
|
179
|
+
expect(set).to eql(Multiset[1, 2, 2, 3])
|
180
180
|
|
181
181
|
ret = set.add(4)
|
182
|
-
set.
|
183
|
-
set.
|
182
|
+
expect(set).to equal(ret)
|
183
|
+
expect(set).to eql(Multiset[1, 2, 2, 3, 4])
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should delete the given object from the set and return self" do
|
187
187
|
set = Multiset[1, 2, 3]
|
188
188
|
|
189
189
|
ret = set.delete(4)
|
190
|
-
set.
|
191
|
-
set.
|
190
|
+
expect(set).to equal(ret)
|
191
|
+
expect(set).to eql(Multiset[1, 2, 3])
|
192
192
|
|
193
193
|
ret = set.delete(2)
|
194
|
-
set.
|
195
|
-
set.
|
194
|
+
expect(set).to eql(ret)
|
195
|
+
expect(set).to eql(Multiset[1, 3])
|
196
196
|
end
|
197
197
|
|
198
198
|
it "should delete every element of the set for which block evaluates to true, and return self" do
|
199
199
|
set = Multiset.new(1..10)
|
200
200
|
ret = set.delete_if { |i| i > 10 }
|
201
|
-
set.
|
202
|
-
set.
|
201
|
+
expect(set).to equal(ret)
|
202
|
+
expect(set).to eql(Multiset.new(1..10))
|
203
203
|
|
204
204
|
set = Multiset.new(1..10)
|
205
205
|
ret = set.delete_if { |i| i % 3 == 0 }
|
206
|
-
set.
|
207
|
-
set.
|
206
|
+
expect(set).to equal(ret)
|
207
|
+
expect(set).to eql(Multiset[1, 2, 4, 5, 7, 8, 10])
|
208
208
|
end
|
209
209
|
|
210
210
|
it "should deletes every element of the set for which block evaluates to true but return nil if no changes were made" do
|
211
211
|
set = Multiset.new(1..10)
|
212
212
|
|
213
213
|
ret = set.reject! { |i| i > 10 }
|
214
|
-
ret.
|
215
|
-
set.
|
214
|
+
expect(ret).to be_nil
|
215
|
+
expect(set).to eql(Multiset.new(1..10))
|
216
216
|
|
217
217
|
ret = set.reject! { |i| i % 3 == 0 }
|
218
|
-
set.
|
219
|
-
set.
|
218
|
+
expect(set).to equal(ret)
|
219
|
+
expect(set).to eql(Multiset[1, 2, 4, 5, 7, 8, 10])
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should merge the elements of the given enumerable object to the set and return self" do
|
223
223
|
set = Multiset[1, 2, 3]
|
224
224
|
|
225
225
|
ret = set.merge([2, 4, 6])
|
226
|
-
set.
|
227
|
-
set.
|
226
|
+
expect(set).to equal(ret)
|
227
|
+
expect(set).to eql(Multiset[1, 2, 2, 3, 4, 6])
|
228
228
|
end
|
229
229
|
|
230
230
|
it "should delete every element that appears in the given enumerable object and return self" do
|
231
231
|
set = Multiset[1, 2, 3]
|
232
232
|
|
233
233
|
ret = set.subtract([2, 4, 6])
|
234
|
-
set.
|
235
|
-
set.
|
234
|
+
expect(set).to equal(ret)
|
235
|
+
expect(set).to eql(Multiset[1, 3])
|
236
236
|
end
|
237
237
|
|
238
238
|
it "should return a new set built by merging the set and the elements of the given enumerable object" do
|
239
239
|
set = Multiset[1, 2, 3]
|
240
240
|
|
241
241
|
ret = set + [2, 4, 6]
|
242
|
-
set.
|
243
|
-
ret.
|
242
|
+
expect(set).to_not equal(ret)
|
243
|
+
expect(ret).to eql(Multiset[1, 2, 2, 3, 4, 6])
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should return a new set built by duplicating the set, removing every element that appears in the given enumerable object" do
|
247
247
|
set = Multiset[1, 2, 3]
|
248
248
|
|
249
249
|
ret = set - [2, 4, 6]
|
250
|
-
set.
|
251
|
-
ret.
|
250
|
+
expect(set).to_not equal(ret)
|
251
|
+
expect(ret).to eql(Multiset[1, 3])
|
252
252
|
end
|
253
253
|
|
254
254
|
it "should return a new set containing elements common to the set and the given enumerable object" do
|
255
255
|
set = Multiset[1, 2, 3, 4]
|
256
256
|
|
257
257
|
ret = set & [2, 4, 6]
|
258
|
-
set.
|
259
|
-
ret.
|
258
|
+
expect(set).to_not equal(ret)
|
259
|
+
expect(ret).to eql(Multiset[2, 4])
|
260
260
|
end
|
261
261
|
|
262
262
|
it "should return a new set containing elements exclusive between the set and the given enumerable object" do
|
263
263
|
set = Multiset[1, 2, 3, 4]
|
264
264
|
ret = set ^ [2, 4, 5]
|
265
|
-
set.
|
266
|
-
ret.
|
265
|
+
expect(set).to_not equal(ret)
|
266
|
+
expect(ret).to eql(Multiset[1, 3, 5])
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
@@ -271,31 +271,31 @@ shared_examples_for Set, "with inital values [1, 2]" do
|
|
271
271
|
it "should add element to set" do
|
272
272
|
@set.add("foo")
|
273
273
|
|
274
|
-
@set.include?(1).
|
275
|
-
@set.include?(2).
|
276
|
-
@set.include?("foo").
|
274
|
+
expect(@set.include?(1)).to be_true
|
275
|
+
expect(@set.include?(2)).to be_true
|
276
|
+
expect(@set.include?("foo")).to be_true
|
277
277
|
end
|
278
278
|
|
279
279
|
it "should merge elements into the set" do
|
280
280
|
@set.merge([2, 6])
|
281
281
|
|
282
|
-
@set.include?(1).
|
283
|
-
@set.include?(2).
|
284
|
-
@set.include?(2).
|
285
|
-
@set.include?(6).
|
282
|
+
expect(@set.include?(1)).to be_true
|
283
|
+
expect(@set.include?(2)).to be_true
|
284
|
+
expect(@set.include?(2)).to be_true
|
285
|
+
expect(@set.include?(6)).to be_true
|
286
286
|
end
|
287
287
|
|
288
288
|
it "should iterate over all the values in the set" do
|
289
289
|
a = []
|
290
290
|
@set.each { |o| a << o }
|
291
|
-
a.
|
291
|
+
expect(a).to eql([1, 2])
|
292
292
|
end
|
293
293
|
|
294
294
|
it "should convert to an array" do
|
295
|
-
@set.to_a.
|
295
|
+
expect(@set.to_a).to eql([1, 2])
|
296
296
|
end
|
297
297
|
|
298
298
|
it "should convert to a set" do
|
299
|
-
@set.to_set.to_a.
|
299
|
+
expect(@set.to_set.to_a).to eql([1, 2])
|
300
300
|
end
|
301
301
|
end
|
@@ -11,11 +11,11 @@ Spec::Matchers.define :sorted_eql do |expected|
|
|
11
11
|
if defined? Rubinius
|
12
12
|
sorter = lambda { |a, b| a.hash <=> b.hash }
|
13
13
|
match do |actual|
|
14
|
-
actual.sort(&sorter).
|
14
|
+
expect(actual.sort(&sorter)).to eql(expected.sort(&sorter))
|
15
15
|
end
|
16
16
|
else
|
17
17
|
match do |actual|
|
18
|
-
actual.
|
18
|
+
expect(actual).to eql(expected)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/mailgun.gemspec
CHANGED
@@ -12,11 +12,9 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
13
|
gem.name = "mailgun"
|
14
14
|
gem.require_paths = ["lib"]
|
15
|
-
gem.version = "0.
|
16
|
-
|
17
|
-
gem.add_dependency(%q<rest-client>, [">= 0"])
|
15
|
+
gem.version = "0.11"
|
18
16
|
|
19
17
|
gem.add_development_dependency(%q<rspec>, [">= 2"])
|
20
|
-
gem.add_development_dependency(%q<
|
21
|
-
gem.add_development_dependency(%q<
|
18
|
+
gem.add_development_dependency(%q<pry>, [">= 0"])
|
19
|
+
gem.add_development_dependency(%q<webmock>, [">= 2"])
|
22
20
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mailgun::Address do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@sample = "foo@mailgun.net"
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "validate an address" do
|
10
|
+
it "should require a public api key" do
|
11
|
+
mailgun = Mailgun({:api_key => "api-key"})
|
12
|
+
expect { mailgun.addresses }.to raise_error(ArgumentError, ":public_api_key is a required argument to validate addresses")
|
13
|
+
end
|
14
|
+
it "should make a GET request with correct params to find a given webhook" do
|
15
|
+
mailgun = Mailgun({:api_key => "api-key", :public_api_key => "public-api-key"})
|
16
|
+
|
17
|
+
sample_response = "{\"is_valid\":true,\"address\":\"foo@mailgun.net\",\"parts\":{\"display_name\":null,\"local_part\":\"foo\",\"domain\":\"mailgun.net\"},\"did_you_mean\":null}"
|
18
|
+
validate_url = mailgun.addresses.send(:address_url, 'validate')
|
19
|
+
|
20
|
+
expect(Mailgun).to receive(:submit).
|
21
|
+
with(:get, validate_url, {:address => @sample}).
|
22
|
+
and_return(sample_response)
|
23
|
+
|
24
|
+
mailgun.addresses.validate(@sample)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|