dmarcator 0.3.1 → 0.4.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 +4 -4
- data/ChangeLog.md +9 -0
- data/README.md +23 -1
- data/lib/dmarcator/exceptions.rb +2 -0
- data/lib/dmarcator/parser.rb +50 -7
- data/lib/dmarcator/query.rb +11 -2
- data/lib/dmarcator/record.rb +13 -10
- data/lib/dmarcator/report/policy.rb +1 -1
- data/lib/dmarcator/report.rb +11 -3
- data/lib/dmarcator/uri.rb +3 -1
- data/lib/dmarcator/version.rb +3 -1
- data/lib/dmarcator/xml_helper.rb +6 -1
- data/lib/dmarcator.rb +2 -0
- metadata +2 -20
- data/spec/data/alexa.csv +0 -500
- data/spec/dmarcator_spec.rb +0 -128
- data/spec/parser_spec.rb +0 -413
- data/spec/record_spec.rb +0 -229
- data/spec/report_spec.rb +0 -108
- data/spec/spec_helper.rb +0 -11
- data/spec/support/complete.xml +0 -364
- data/spec/support/google.xml +0 -353
- data/spec/uri_spec.rb +0 -187
data/spec/support/google.xml
DELETED
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<feedback>
|
|
3
|
-
<report_metadata>
|
|
4
|
-
<org_name>google.com</org_name>
|
|
5
|
-
<email>noreply-dmarc-support@google.com</email>
|
|
6
|
-
<extra_contact_info>https://support.google.com/a/answer/2466580</extra_contact_info>
|
|
7
|
-
<report_id>3114726731964606297</report_id>
|
|
8
|
-
<date_range>
|
|
9
|
-
<begin>1593648000</begin>
|
|
10
|
-
<end>1593734399</end>
|
|
11
|
-
</date_range>
|
|
12
|
-
</report_metadata>
|
|
13
|
-
<policy_published>
|
|
14
|
-
<domain>opserv.io</domain>
|
|
15
|
-
<adkim>r</adkim>
|
|
16
|
-
<aspf>r</aspf>
|
|
17
|
-
<p>none</p>
|
|
18
|
-
<sp>none</sp>
|
|
19
|
-
<pct>100</pct>
|
|
20
|
-
</policy_published>
|
|
21
|
-
<record>
|
|
22
|
-
<row>
|
|
23
|
-
<source_ip>209.85.220.69</source_ip>
|
|
24
|
-
<count>96</count>
|
|
25
|
-
<policy_evaluated>
|
|
26
|
-
<disposition>none</disposition>
|
|
27
|
-
<dkim>fail</dkim>
|
|
28
|
-
<spf>fail</spf>
|
|
29
|
-
<reason>
|
|
30
|
-
<type>local_policy</type>
|
|
31
|
-
<comment>arc=pass</comment>
|
|
32
|
-
</reason>
|
|
33
|
-
</policy_evaluated>
|
|
34
|
-
</row>
|
|
35
|
-
<identifiers>
|
|
36
|
-
<header_from>opserv.io</header_from>
|
|
37
|
-
</identifiers>
|
|
38
|
-
<auth_results>
|
|
39
|
-
<dkim>
|
|
40
|
-
<domain>condenast-com-tw.20150623.gappssmtp.com</domain>
|
|
41
|
-
<result>pass</result>
|
|
42
|
-
<selector>20150623</selector>
|
|
43
|
-
</dkim>
|
|
44
|
-
<spf>
|
|
45
|
-
<domain>condenast.com.tw</domain>
|
|
46
|
-
<result>neutral</result>
|
|
47
|
-
</spf>
|
|
48
|
-
</auth_results>
|
|
49
|
-
</record>
|
|
50
|
-
<record>
|
|
51
|
-
<row>
|
|
52
|
-
<source_ip>167.89.100.132</source_ip>
|
|
53
|
-
<count>11</count>
|
|
54
|
-
<policy_evaluated>
|
|
55
|
-
<disposition>none</disposition>
|
|
56
|
-
<dkim>pass</dkim>
|
|
57
|
-
<spf>pass</spf>
|
|
58
|
-
</policy_evaluated>
|
|
59
|
-
</row>
|
|
60
|
-
<identifiers>
|
|
61
|
-
<header_from>opserv.io</header_from>
|
|
62
|
-
</identifiers>
|
|
63
|
-
<auth_results>
|
|
64
|
-
<dkim>
|
|
65
|
-
<domain>opserv.io</domain>
|
|
66
|
-
<result>pass</result>
|
|
67
|
-
<selector>s1</selector>
|
|
68
|
-
</dkim>
|
|
69
|
-
<dkim>
|
|
70
|
-
<domain>sendgrid.info</domain>
|
|
71
|
-
<result>pass</result>
|
|
72
|
-
<selector>smtpapi</selector>
|
|
73
|
-
</dkim>
|
|
74
|
-
<spf>
|
|
75
|
-
<domain>alert.opserv.io</domain>
|
|
76
|
-
<result>pass</result>
|
|
77
|
-
</spf>
|
|
78
|
-
</auth_results>
|
|
79
|
-
</record>
|
|
80
|
-
<record>
|
|
81
|
-
<row>
|
|
82
|
-
<source_ip>167.89.100.13</source_ip>
|
|
83
|
-
<count>96</count>
|
|
84
|
-
<policy_evaluated>
|
|
85
|
-
<disposition>none</disposition>
|
|
86
|
-
<dkim>pass</dkim>
|
|
87
|
-
<spf>pass</spf>
|
|
88
|
-
</policy_evaluated>
|
|
89
|
-
</row>
|
|
90
|
-
<identifiers>
|
|
91
|
-
<header_from>opserv.io</header_from>
|
|
92
|
-
</identifiers>
|
|
93
|
-
<auth_results>
|
|
94
|
-
<dkim>
|
|
95
|
-
<domain>opserv.io</domain>
|
|
96
|
-
<result>pass</result>
|
|
97
|
-
<selector>s1</selector>
|
|
98
|
-
</dkim>
|
|
99
|
-
<dkim>
|
|
100
|
-
<domain>sendgrid.info</domain>
|
|
101
|
-
<result>pass</result>
|
|
102
|
-
<selector>smtpapi</selector>
|
|
103
|
-
</dkim>
|
|
104
|
-
<spf>
|
|
105
|
-
<domain>alert.opserv.io</domain>
|
|
106
|
-
<result>pass</result>
|
|
107
|
-
</spf>
|
|
108
|
-
</auth_results>
|
|
109
|
-
</record>
|
|
110
|
-
<record>
|
|
111
|
-
<row>
|
|
112
|
-
<source_ip>167.89.100.13</source_ip>
|
|
113
|
-
<count>161</count>
|
|
114
|
-
<policy_evaluated>
|
|
115
|
-
<disposition>none</disposition>
|
|
116
|
-
<dkim>pass</dkim>
|
|
117
|
-
<spf>pass</spf>
|
|
118
|
-
</policy_evaluated>
|
|
119
|
-
</row>
|
|
120
|
-
<identifiers>
|
|
121
|
-
<header_from>opserv.io</header_from>
|
|
122
|
-
</identifiers>
|
|
123
|
-
<auth_results>
|
|
124
|
-
<dkim>
|
|
125
|
-
<domain>opserv.io</domain>
|
|
126
|
-
<result>pass</result>
|
|
127
|
-
<selector>s1</selector>
|
|
128
|
-
</dkim>
|
|
129
|
-
<spf>
|
|
130
|
-
<domain>alert.opserv.io</domain>
|
|
131
|
-
<result>pass</result>
|
|
132
|
-
</spf>
|
|
133
|
-
</auth_results>
|
|
134
|
-
</record>
|
|
135
|
-
<record>
|
|
136
|
-
<row>
|
|
137
|
-
<source_ip>50.31.60.236</source_ip>
|
|
138
|
-
<count>28</count>
|
|
139
|
-
<policy_evaluated>
|
|
140
|
-
<disposition>none</disposition>
|
|
141
|
-
<dkim>pass</dkim>
|
|
142
|
-
<spf>pass</spf>
|
|
143
|
-
</policy_evaluated>
|
|
144
|
-
</row>
|
|
145
|
-
<identifiers>
|
|
146
|
-
<header_from>opserv.io</header_from>
|
|
147
|
-
</identifiers>
|
|
148
|
-
<auth_results>
|
|
149
|
-
<dkim>
|
|
150
|
-
<domain>opserv.io</domain>
|
|
151
|
-
<result>pass</result>
|
|
152
|
-
<selector>s1</selector>
|
|
153
|
-
</dkim>
|
|
154
|
-
<spf>
|
|
155
|
-
<domain>alert.opserv.io</domain>
|
|
156
|
-
<result>pass</result>
|
|
157
|
-
</spf>
|
|
158
|
-
</auth_results>
|
|
159
|
-
</record>
|
|
160
|
-
<record>
|
|
161
|
-
<row>
|
|
162
|
-
<source_ip>50.31.60.236</source_ip>
|
|
163
|
-
<count>13</count>
|
|
164
|
-
<policy_evaluated>
|
|
165
|
-
<disposition>none</disposition>
|
|
166
|
-
<dkim>pass</dkim>
|
|
167
|
-
<spf>pass</spf>
|
|
168
|
-
</policy_evaluated>
|
|
169
|
-
</row>
|
|
170
|
-
<identifiers>
|
|
171
|
-
<header_from>opserv.io</header_from>
|
|
172
|
-
</identifiers>
|
|
173
|
-
<auth_results>
|
|
174
|
-
<dkim>
|
|
175
|
-
<domain>opserv.io</domain>
|
|
176
|
-
<result>pass</result>
|
|
177
|
-
<selector>s1</selector>
|
|
178
|
-
</dkim>
|
|
179
|
-
<dkim>
|
|
180
|
-
<domain>sendgrid.info</domain>
|
|
181
|
-
<result>pass</result>
|
|
182
|
-
<selector>smtpapi</selector>
|
|
183
|
-
</dkim>
|
|
184
|
-
<spf>
|
|
185
|
-
<domain>alert.opserv.io</domain>
|
|
186
|
-
<result>pass</result>
|
|
187
|
-
</spf>
|
|
188
|
-
</auth_results>
|
|
189
|
-
</record>
|
|
190
|
-
<record>
|
|
191
|
-
<row>
|
|
192
|
-
<source_ip>209.85.220.41</source_ip>
|
|
193
|
-
<count>3</count>
|
|
194
|
-
<policy_evaluated>
|
|
195
|
-
<disposition>none</disposition>
|
|
196
|
-
<dkim>pass</dkim>
|
|
197
|
-
<spf>fail</spf>
|
|
198
|
-
</policy_evaluated>
|
|
199
|
-
</row>
|
|
200
|
-
<identifiers>
|
|
201
|
-
<header_from>opserv.io</header_from>
|
|
202
|
-
</identifiers>
|
|
203
|
-
<auth_results>
|
|
204
|
-
<dkim>
|
|
205
|
-
<domain>opserv.io</domain>
|
|
206
|
-
<result>pass</result>
|
|
207
|
-
<selector>s1</selector>
|
|
208
|
-
</dkim>
|
|
209
|
-
<spf>
|
|
210
|
-
<domain>hta.gr</domain>
|
|
211
|
-
<result>pass</result>
|
|
212
|
-
</spf>
|
|
213
|
-
</auth_results>
|
|
214
|
-
</record>
|
|
215
|
-
<record>
|
|
216
|
-
<row>
|
|
217
|
-
<source_ip>209.85.220.69</source_ip>
|
|
218
|
-
<count>10</count>
|
|
219
|
-
<policy_evaluated>
|
|
220
|
-
<disposition>none</disposition>
|
|
221
|
-
<dkim>fail</dkim>
|
|
222
|
-
<spf>fail</spf>
|
|
223
|
-
<reason>
|
|
224
|
-
<type>local_policy</type>
|
|
225
|
-
<comment>arc=pass</comment>
|
|
226
|
-
</reason>
|
|
227
|
-
</policy_evaluated>
|
|
228
|
-
</row>
|
|
229
|
-
<identifiers>
|
|
230
|
-
<header_from>opserv.io</header_from>
|
|
231
|
-
</identifiers>
|
|
232
|
-
<auth_results>
|
|
233
|
-
<dkim>
|
|
234
|
-
<domain>unicstay-com.20150623.gappssmtp.com</domain>
|
|
235
|
-
<result>pass</result>
|
|
236
|
-
<selector>20150623</selector>
|
|
237
|
-
</dkim>
|
|
238
|
-
<spf>
|
|
239
|
-
<domain>unicstay.com</domain>
|
|
240
|
-
<result>pass</result>
|
|
241
|
-
</spf>
|
|
242
|
-
</auth_results>
|
|
243
|
-
</record>
|
|
244
|
-
<record>
|
|
245
|
-
<row>
|
|
246
|
-
<source_ip>209.85.220.41</source_ip>
|
|
247
|
-
<count>3</count>
|
|
248
|
-
<policy_evaluated>
|
|
249
|
-
<disposition>none</disposition>
|
|
250
|
-
<dkim>pass</dkim>
|
|
251
|
-
<spf>fail</spf>
|
|
252
|
-
</policy_evaluated>
|
|
253
|
-
</row>
|
|
254
|
-
<identifiers>
|
|
255
|
-
<header_from>opserv.io</header_from>
|
|
256
|
-
</identifiers>
|
|
257
|
-
<auth_results>
|
|
258
|
-
<dkim>
|
|
259
|
-
<domain>opserv.io</domain>
|
|
260
|
-
<result>pass</result>
|
|
261
|
-
<selector>s1</selector>
|
|
262
|
-
</dkim>
|
|
263
|
-
<dkim>
|
|
264
|
-
<domain>sendgrid.info</domain>
|
|
265
|
-
<result>pass</result>
|
|
266
|
-
<selector>smtpapi</selector>
|
|
267
|
-
</dkim>
|
|
268
|
-
<spf>
|
|
269
|
-
<domain>gmail.com</domain>
|
|
270
|
-
<result>pass</result>
|
|
271
|
-
</spf>
|
|
272
|
-
</auth_results>
|
|
273
|
-
</record>
|
|
274
|
-
<record>
|
|
275
|
-
<row>
|
|
276
|
-
<source_ip>167.89.100.132</source_ip>
|
|
277
|
-
<count>31</count>
|
|
278
|
-
<policy_evaluated>
|
|
279
|
-
<disposition>none</disposition>
|
|
280
|
-
<dkim>pass</dkim>
|
|
281
|
-
<spf>pass</spf>
|
|
282
|
-
</policy_evaluated>
|
|
283
|
-
</row>
|
|
284
|
-
<identifiers>
|
|
285
|
-
<header_from>opserv.io</header_from>
|
|
286
|
-
</identifiers>
|
|
287
|
-
<auth_results>
|
|
288
|
-
<dkim>
|
|
289
|
-
<domain>opserv.io</domain>
|
|
290
|
-
<result>pass</result>
|
|
291
|
-
<selector>s1</selector>
|
|
292
|
-
</dkim>
|
|
293
|
-
<spf>
|
|
294
|
-
<domain>alert.opserv.io</domain>
|
|
295
|
-
<result>pass</result>
|
|
296
|
-
</spf>
|
|
297
|
-
</auth_results>
|
|
298
|
-
</record>
|
|
299
|
-
<record>
|
|
300
|
-
<row>
|
|
301
|
-
<source_ip>209.85.220.69</source_ip>
|
|
302
|
-
<count>6</count>
|
|
303
|
-
<policy_evaluated>
|
|
304
|
-
<disposition>none</disposition>
|
|
305
|
-
<dkim>fail</dkim>
|
|
306
|
-
<spf>fail</spf>
|
|
307
|
-
<reason>
|
|
308
|
-
<type>local_policy</type>
|
|
309
|
-
<comment>arc=pass</comment>
|
|
310
|
-
</reason>
|
|
311
|
-
</policy_evaluated>
|
|
312
|
-
</row>
|
|
313
|
-
<identifiers>
|
|
314
|
-
<header_from>opserv.io</header_from>
|
|
315
|
-
</identifiers>
|
|
316
|
-
<auth_results>
|
|
317
|
-
<dkim>
|
|
318
|
-
<domain>sportskeeda.com</domain>
|
|
319
|
-
<result>pass</result>
|
|
320
|
-
<selector>google</selector>
|
|
321
|
-
</dkim>
|
|
322
|
-
<spf>
|
|
323
|
-
<domain>sportskeeda.com</domain>
|
|
324
|
-
<result>pass</result>
|
|
325
|
-
</spf>
|
|
326
|
-
</auth_results>
|
|
327
|
-
</record>
|
|
328
|
-
<record>
|
|
329
|
-
<row>
|
|
330
|
-
<source_ip>209.85.220.41</source_ip>
|
|
331
|
-
<count>66</count>
|
|
332
|
-
<policy_evaluated>
|
|
333
|
-
<disposition>none</disposition>
|
|
334
|
-
<dkim>pass</dkim>
|
|
335
|
-
<spf>fail</spf>
|
|
336
|
-
</policy_evaluated>
|
|
337
|
-
</row>
|
|
338
|
-
<identifiers>
|
|
339
|
-
<header_from>opserv.io</header_from>
|
|
340
|
-
</identifiers>
|
|
341
|
-
<auth_results>
|
|
342
|
-
<dkim>
|
|
343
|
-
<domain>opserv.io</domain>
|
|
344
|
-
<result>pass</result>
|
|
345
|
-
<selector>s1</selector>
|
|
346
|
-
</dkim>
|
|
347
|
-
<spf>
|
|
348
|
-
<domain>mmprojects.co.uk</domain>
|
|
349
|
-
<result>pass</result>
|
|
350
|
-
</spf>
|
|
351
|
-
</auth_results>
|
|
352
|
-
</record>
|
|
353
|
-
</feedback>
|
data/spec/uri_spec.rb
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'dmarcator/uri'
|
|
3
|
-
|
|
4
|
-
describe DMARCator::Uri do
|
|
5
|
-
let(:uri) { URI("mailto:d@ruf.agari.com") }
|
|
6
|
-
let(:size) { 10 }
|
|
7
|
-
let(:unit) { :m }
|
|
8
|
-
|
|
9
|
-
subject { described_class.new(uri,size,unit) }
|
|
10
|
-
|
|
11
|
-
describe "#initialize" do
|
|
12
|
-
it "should set the uri" do
|
|
13
|
-
expect(subject.uri).to be uri
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "should set the size" do
|
|
17
|
-
expect(subject.size).to be size
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should set the unit" do
|
|
21
|
-
expect(subject.unit).to be unit
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "when size is omitted" do
|
|
25
|
-
subject { described_class.new(uri) }
|
|
26
|
-
|
|
27
|
-
it "should set size to nil" do
|
|
28
|
-
expect(subject.size).to be(nil)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "should set unit to nil" do
|
|
32
|
-
expect(subject.unit).to be(nil)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context "when unit is omitted" do
|
|
37
|
-
subject { described_class.new(uri,size) }
|
|
38
|
-
|
|
39
|
-
it "should set size" do
|
|
40
|
-
expect(subject.size).to be(size)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "should set unit to nil" do
|
|
44
|
-
expect(subject.unit).to be(nil)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe "#size?" do
|
|
50
|
-
context "when size is nil" do
|
|
51
|
-
subject { described_class.new(uri) }
|
|
52
|
-
|
|
53
|
-
it { expect(subject.size?).to be(false) }
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
context "when size is set" do
|
|
57
|
-
subject { described_class.new(uri,size) }
|
|
58
|
-
|
|
59
|
-
it { expect(subject.size?).to be(true) }
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
describe "#unit?" do
|
|
64
|
-
context "when unit is nil" do
|
|
65
|
-
subject { described_class.new(uri,size) }
|
|
66
|
-
|
|
67
|
-
it { expect(subject.unit?).to be(false) }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
context "when unit is set" do
|
|
71
|
-
subject { described_class.new(uri,size,unit) }
|
|
72
|
-
|
|
73
|
-
it { expect(subject.unit?).to be(true) }
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
describe "#==" do
|
|
78
|
-
context "when other is a #{described_class}" do
|
|
79
|
-
context "and all fields match" do
|
|
80
|
-
let(:other) { described_class.new(uri.dup,size,unit) }
|
|
81
|
-
|
|
82
|
-
it { expect(subject == other).to be(true) }
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
context "but the uri is different" do
|
|
86
|
-
let(:other_uri) { URI("mailto:foo@example.com") }
|
|
87
|
-
let(:other) { described_class.new(other_uri,size,unit) }
|
|
88
|
-
|
|
89
|
-
it { expect(subject == other).to be(false) }
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
context "but the size is different" do
|
|
93
|
-
let(:other) { described_class.new(uri,42,unit) }
|
|
94
|
-
|
|
95
|
-
it { expect(subject == other).to be(false) }
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
context "but the unit is different" do
|
|
99
|
-
let(:other) { described_class.new(uri,size,:t) }
|
|
100
|
-
|
|
101
|
-
it { expect(subject == other).to be(false) }
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
context "when other is a different class" do
|
|
106
|
-
let(:other) { Object.new }
|
|
107
|
-
|
|
108
|
-
it { expect(subject == other).to be(false) }
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
describe "#eql?" do
|
|
113
|
-
it "is true when all fields match" do
|
|
114
|
-
other = described_class.new(uri.dup, size, unit)
|
|
115
|
-
|
|
116
|
-
expect(subject.eql?(other)).to be(true)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it "is false when the uri differs" do
|
|
120
|
-
other = described_class.new(URI("mailto:other@example.com"), size, unit)
|
|
121
|
-
|
|
122
|
-
expect(subject.eql?(other)).to be(false)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "is false for a different class" do
|
|
126
|
-
expect(subject.eql?(Object.new)).to be(false)
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
describe "#hash" do
|
|
131
|
-
it "is equal for equivalent URIs" do
|
|
132
|
-
other = described_class.new(uri.dup, size, unit)
|
|
133
|
-
|
|
134
|
-
expect(subject.hash).to eq(other.hash)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
it "differs for non-equivalent URIs" do
|
|
138
|
-
other = described_class.new(URI("mailto:other@example.com"), size, unit)
|
|
139
|
-
|
|
140
|
-
expect(subject.hash).not_to eq(other.hash)
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
describe "Hash/Set semantics" do
|
|
145
|
-
it "deduplicates equivalent URIs" do
|
|
146
|
-
other = described_class.new(uri.dup, size, unit)
|
|
147
|
-
|
|
148
|
-
expect([subject, other].uniq.size).to eq(1)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
it "treats equivalent URIs as the same Hash key" do
|
|
152
|
-
other = described_class.new(uri.dup, size, unit)
|
|
153
|
-
|
|
154
|
-
expect({ subject => 1 }.key?(other)).to be(true)
|
|
155
|
-
end
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
describe "#to_s" do
|
|
159
|
-
context "when only the uri is set" do
|
|
160
|
-
subject { described_class.new(uri) }
|
|
161
|
-
|
|
162
|
-
it "should return the uri" do
|
|
163
|
-
expect(subject.to_s).to be == uri.to_s
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
context "when uri and size are set" do
|
|
168
|
-
subject { described_class.new(uri,size) }
|
|
169
|
-
|
|
170
|
-
it "should return the uri!size" do
|
|
171
|
-
expect(subject.to_s).to be == "#{uri}!#{size}"
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
context "when uri, size and unit are set" do
|
|
176
|
-
it "should return the uri!size" do
|
|
177
|
-
expect(subject.to_s).to be == "#{uri}!#{size}#{unit}"
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
describe "#method_missing" do
|
|
183
|
-
it "should pass through methods to uri" do
|
|
184
|
-
expect(subject.host).to be(uri.host)
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
end
|