author | Mahlon E. Smith <mahlon@laika.com> |
Fri, 12 May 2017 16:17:41 -0700 | |
changeset 16 | e135ccae6783 |
parent 15 | a38e6916504c |
child 17 | 23c7f5c8ee39 |
permissions | -rw-r--r-- |
15 | 1 |
# vim: set nosta noet ts=4 sw=4 ft=rspec: |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
2 |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
3 |
require_relative '../spec_helpers' |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
4 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
5 |
describe Ezmlm::List do |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
6 |
|
14 | 7 |
before( :each ) do |
8 |
@listdir = make_listdir() |
|
9 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
10 |
|
14 | 11 |
after( :each ) do |
12 |
rm_r( @listdir ) |
|
13 |
end |
|
14 |
||
15 |
let( :list ) do |
|
16 |
described_class.new( @listdir ) |
|
17 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
18 |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
19 |
|
15 | 20 |
it "returns the list name" do |
14 | 21 |
expect( list.name ).to eq( TEST_LIST_NAME ) |
22 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
23 |
|
15 | 24 |
it "returns the list host" do |
14 | 25 |
expect( list.host ).to eq( TEST_LIST_HOST ) |
26 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
27 |
|
15 | 28 |
it "returns the list address" do |
14 | 29 |
expect( list.address ).to eq( TEST_LIST_NAME + '@' + TEST_LIST_HOST ) |
30 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
31 |
|
14 | 32 |
it "returns nil if the list owner isn't an email address" do |
33 |
expect( list.owner ).to eq( nil ) |
|
34 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
35 |
|
15 | 36 |
it "returns an email address owner" do |
14 | 37 |
expect( list ).to receive( :read ).with( 'owner' ).and_return( TEST_OWNER ) |
38 |
expect( list.owner ).to eq( TEST_OWNER ) |
|
39 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
40 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
41 |
|
14 | 42 |
it "can add a new subscriber" do |
43 |
list.add_subscriber( *TEST_SUBSCRIBERS ) |
|
44 |
expect( list.is_subscriber?( TEST_SUBSCRIBERS.first ) ).to be_truthy |
|
45 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
46 |
|
15 | 47 |
it "returns the list of subscibers" do |
14 | 48 |
list.add_subscriber( *TEST_SUBSCRIBERS ) |
49 |
list.add_subscriber( 'notanemailaddress' ) |
|
50 |
expect( list.subscribers.length ).to eq( 3 ) |
|
51 |
expect( list.subscribers ).to include( TEST_SUBSCRIBERS.first ) |
|
52 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
53 |
|
14 | 54 |
it "can remove a current subscriber" do |
55 |
list.add_subscriber( *TEST_SUBSCRIBERS ) |
|
56 |
list.remove_subscriber( 'notanemailaddress' ) |
|
57 |
list.remove_subscriber( TEST_MODERATORS.first ) |
|
58 |
expect( list.subscribers.length ).to eq( 2 ) |
|
59 |
end |
|
5
804e1c2b9a40
* Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents:
4
diff
changeset
|
60 |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
61 |
|
14 | 62 |
it "can add a new moderator" do |
63 |
list.add_moderator( *TEST_MODERATORS ) |
|
64 |
expect( list.is_moderator?( TEST_MODERATORS.first ) ).to be_truthy |
|
65 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
66 |
|
15 | 67 |
it "returns the list of moderators" do |
14 | 68 |
list.add_moderator( *TEST_MODERATORS ) |
69 |
expect( list.moderators.length ).to eq( 1 ) |
|
70 |
expect( list.moderators ).to include( TEST_MODERATORS.first ) |
|
71 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
72 |
|
14 | 73 |
it "can remove a current moderator" do |
74 |
list.add_moderator( *TEST_MODERATORS ) |
|
75 |
list.remove_moderator( TEST_MODERATORS.first ) |
|
76 |
expect( list.moderators ).to be_empty |
|
77 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
78 |
|
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
79 |
|
14 | 80 |
it "can add a blacklisted address" do |
81 |
list.add_blacklisted( *TEST_MODERATORS ) |
|
82 |
expect( list.is_blacklisted?( TEST_MODERATORS.first ) ).to be_truthy |
|
83 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
84 |
|
15 | 85 |
it "returns the list of blacklisted addresses" do |
14 | 86 |
list.add_blacklisted( *TEST_MODERATORS ) |
87 |
expect( list.blacklisted.length ).to eq( 1 ) |
|
88 |
expect( list.blacklisted ).to include( TEST_MODERATORS.first ) |
|
89 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
90 |
|
14 | 91 |
it "can remove a blacklisted address" do |
92 |
list.add_blacklisted( *TEST_MODERATORS ) |
|
93 |
list.remove_blacklisted( TEST_MODERATORS.first ) |
|
94 |
expect( list.blacklisted ).to be_empty |
|
95 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
96 |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
97 |
|
14 | 98 |
it "can add an allowed address" do |
99 |
list.add_allowed( *TEST_MODERATORS ) |
|
100 |
expect( list.is_allowed?( TEST_MODERATORS.first ) ).to be_truthy |
|
101 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
102 |
|
15 | 103 |
it "returns the list of allowed addresses" do |
14 | 104 |
list.add_allowed( *TEST_MODERATORS ) |
105 |
expect( list.allowed.length ).to eq( 1 ) |
|
106 |
expect( list.allowed ).to include( TEST_MODERATORS.first ) |
|
107 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
108 |
|
14 | 109 |
it "can remove a allowed address" do |
110 |
list.add_allowed( *TEST_MODERATORS ) |
|
111 |
list.remove_allowed( TEST_MODERATORS.first ) |
|
112 |
expect( list.allowed ).to be_empty |
|
113 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
114 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
115 |
|
15 | 116 |
it 'returns the current threading state' do |
117 |
expect( list.threaded? ).to be_truthy |
|
14 | 118 |
end |
3
9b9e85ccf4f9
Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents:
2
diff
changeset
|
119 |
|
14 | 120 |
it 'can set the threading state' do |
15 | 121 |
list.threaded = false |
122 |
expect( list.threaded? ).to be_falsey |
|
14 | 123 |
end |
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
124 |
|
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
125 |
|
15 | 126 |
it 'returns the current public/private state' do |
14 | 127 |
expect( list.public? ).to be_truthy |
128 |
expect( list.private? ).to be_falsey |
|
129 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
130 |
|
14 | 131 |
it 'can set the privacy state' do |
132 |
list.public = false |
|
133 |
expect( list.public? ).to be_falsey |
|
134 |
expect( list.private? ).to be_truthy |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
135 |
|
14 | 136 |
list.private = false |
137 |
expect( list.private? ).to be_falsey |
|
138 |
expect( list.public? ).to be_truthy |
|
139 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
140 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
141 |
|
14 | 142 |
it 'can set the remote subscription state' do |
143 |
expect( list.remote_subscriptions? ).to be_falsey |
|
144 |
list.remote_subscriptions = true |
|
145 |
expect( list.remote_subscriptions? ).to be_truthy |
|
146 |
list.remote_subscriptions = false |
|
147 |
expect( list.remote_subscriptions? ).to be_falsey |
|
148 |
end |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
149 |
|
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
150 |
|
14 | 151 |
it 'can set subscription moderation state' do |
152 |
expect( list.moderated_subscriptions? ).to be_falsey |
|
153 |
list.moderated_subscriptions = true |
|
154 |
expect( list.moderated_subscriptions? ).to be_truthy |
|
155 |
list.moderated_subscriptions = false |
|
156 |
expect( list.moderated_subscriptions? ).to be_falsey |
|
157 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
158 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
159 |
|
14 | 160 |
it 'can set posting moderation state' do |
161 |
expect( list.moderated? ).to be_falsey |
|
162 |
list.moderated = true |
|
163 |
expect( list.moderated? ).to be_truthy |
|
164 |
list.moderated = false |
|
165 |
expect( list.moderated? ).to be_falsey |
|
2
7b5a0131d5cd
Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents:
1
diff
changeset
|
166 |
end |
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
167 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
168 |
|
14 | 169 |
it 'can set moderation-only posting' do |
170 |
expect( list.moderator_posts_only? ).to be_falsey |
|
171 |
list.moderator_posts_only = true |
|
172 |
expect( list.moderator_posts_only? ).to be_truthy |
|
173 |
list.moderator_posts_only = false |
|
174 |
expect( list.moderator_posts_only? ).to be_falsey |
|
175 |
end |
|
176 |
||
177 |
||
178 |
it 'can set user-only posting' do |
|
179 |
expect( list.user_posts_only? ).to be_falsey |
|
180 |
list.user_posts_only = true |
|
181 |
expect( list.user_posts_only? ).to be_truthy |
|
182 |
list.user_posts_only = false |
|
183 |
expect( list.user_posts_only? ).to be_falsey |
|
184 |
end |
|
185 |
||
186 |
||
187 |
it 'user+moderation together sets non-subscriber moderation' do |
|
188 |
expect( list.user_posts_only? ).to be_falsey |
|
189 |
expect( list.moderated? ).to be_falsey |
|
190 |
||
191 |
list.moderated = true |
|
192 |
list.user_posts_only = true |
|
193 |
||
194 |
expect( list.listdir + 'noreturnposts' ).to exist |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
195 |
|
14 | 196 |
list.moderated = false |
197 |
expect( list.listdir + 'noreturnposts' ).to_not exist |
|
198 |
end |
|
199 |
||
200 |
||
201 |
it 'can set archival status' do |
|
202 |
expect( list.archived? ).to be_truthy |
|
203 |
list.archive = false |
|
204 |
expect( list.archived? ).to be_falsey |
|
205 |
list.archive = true |
|
206 |
expect( list.archived? ).to be_truthy |
|
207 |
end |
|
208 |
||
209 |
||
210 |
it 'can limit archive access to moderators only' do |
|
211 |
expect( list.private_archive? ).to be_falsey |
|
212 |
list.private_archive = true |
|
213 |
expect( list.private_archive? ).to be_truthy |
|
214 |
list.private_archive = false |
|
215 |
expect( list.private_archive? ).to be_falsey |
|
216 |
end |
|
217 |
||
218 |
||
219 |
it 'can limit archive access to list subscribers only' do |
|
220 |
expect( list.guarded_archive? ).to be_falsey |
|
221 |
list.guarded_archive = true |
|
222 |
expect( list.guarded_archive? ).to be_truthy |
|
223 |
list.guarded_archive = false |
|
224 |
expect( list.guarded_archive? ).to be_falsey |
|
225 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
226 |
|
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
227 |
|
14 | 228 |
it 'can toggle digest status' do |
229 |
expect( list.digested? ).to be_falsey |
|
230 |
list.digest = true |
|
231 |
expect( list.digested? ).to be_truthy |
|
232 |
list.digest = false |
|
233 |
expect( list.digested? ).to be_falsey |
|
234 |
end |
|
235 |
||
236 |
it 'returns a default digest kbyte size' do |
|
237 |
expect( list.digest_kbytesize ).to eq( 64 ) |
|
238 |
end |
|
239 |
||
240 |
it 'can set a new digest kbyte size' do |
|
241 |
list.digest_kbytesize = 300 |
|
242 |
expect( list.digest_kbytesize ).to eq( 300 ) |
|
243 |
end |
|
244 |
||
245 |
it 'returns a default digest message count' do |
|
246 |
expect( list.digest_count ).to eq( 10 ) |
|
247 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
248 |
|
14 | 249 |
it 'can set a new digest message count' do |
250 |
list.digest_count = 25 |
|
251 |
expect( list.digest_count ).to eq( 25 ) |
|
252 |
end |
|
253 |
||
254 |
it 'returns a default digest timeout' do |
|
255 |
expect( list.digest_timeout ).to eq( 48 ) |
|
256 |
end |
|
257 |
||
258 |
it 'can set a new digest timeout' do |
|
259 |
list.digest_timeout = 24 |
|
260 |
expect( list.digest_timeout ).to eq( 24 ) |
|
261 |
end |
|
262 |
||
263 |
||
264 |
it 'can set subscription confirmation' do |
|
265 |
expect( list.confirm_subscriptions? ).to be_truthy |
|
266 |
list.confirm_subscriptions = false |
|
267 |
expect( list.confirm_subscriptions? ).to be_falsey |
|
268 |
list.confirm_subscriptions = true |
|
269 |
expect( list.confirm_subscriptions? ).to be_truthy |
|
270 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
271 |
|
14 | 272 |
it 'can set unsubscription confirmation' do |
273 |
expect( list.confirm_unsubscriptions? ).to be_truthy |
|
274 |
list.confirm_unsubscriptions = false |
|
275 |
expect( list.confirm_unsubscriptions? ).to be_falsey |
|
276 |
list.confirm_unsubscriptions = true |
|
277 |
expect( list.confirm_unsubscriptions? ).to be_truthy |
|
278 |
end |
|
279 |
||
280 |
||
281 |
it 'can set message posting confirmation' do |
|
282 |
expect( list.confirm_postings? ).to be_falsey |
|
283 |
list.confirm_postings = true |
|
284 |
expect( list.confirm_postings? ).to be_truthy |
|
285 |
list.confirm_postings = false |
|
286 |
expect( list.confirm_postings? ).to be_falsey |
|
287 |
end |
|
288 |
||
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
289 |
|
14 | 290 |
it 'can toggle remote subscriber lists for moderators' do |
291 |
expect( list.allow_remote_listing? ).to be_falsey |
|
292 |
list.allow_remote_listing = true |
|
293 |
expect( list.allow_remote_listing? ).to be_truthy |
|
294 |
list.allow_remote_listing = false |
|
295 |
expect( list.allow_remote_listing? ).to be_falsey |
|
296 |
end |
|
297 |
||
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
298 |
|
14 | 299 |
it 'can toggle bounce management' do |
300 |
expect( list.bounce_warnings? ).to be_truthy |
|
301 |
list.bounce_warnings = false |
|
302 |
expect( list.bounce_warnings? ).to be_falsey |
|
303 |
list.bounce_warnings = true |
|
304 |
expect( list.bounce_warnings? ).to be_truthy |
|
305 |
end |
|
306 |
||
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
307 |
|
14 | 308 |
it 'returns a default max message size' do |
309 |
expect( list.maximum_message_size ).to eq( 0 ) |
|
310 |
end |
|
311 |
||
312 |
it 'can set a new max message size' do |
|
313 |
list.maximum_message_size = 1024 * 300 |
|
314 |
expect( list.maximum_message_size ).to eq( 307200 ) |
|
315 |
end |
|
316 |
||
317 |
||
15 | 318 |
it 'can return the total message count for a pristine list' do |
319 |
expect( list ).to receive( :read ).with( 'archnum' ).and_return( nil ) |
|
14 | 320 |
expect( list.message_count ).to eq( 0 ) |
321 |
end |
|
15 | 322 |
|
323 |
it 'can return the total message count for a list with deliveries' do |
|
324 |
expect( list.message_count ).to eq( 150 ) |
|
325 |
end |
|
326 |
||
327 |
||
328 |
it 'can generate a message number to thread index' do |
|
329 |
idx = list.index |
|
330 |
expect( idx.size ).to be( 150 ) |
|
331 |
expect( idx[39][:thread] ).to eq( 'cadgeokhhaieijmndokb' ) |
|
332 |
end |
|
333 |
||
334 |
||
335 |
it 'fetches thread objects upon request' do |
|
336 |
expect( list.thread('cadgeokhhaieijmndokb') ).to be_a( Ezmlm::List::Thread ) |
|
337 |
end |
|
338 |
||
339 |
||
340 |
it 'fetches author objects upon request' do |
|
341 |
expect( list.author('ojjhjlapnejjlbcplabi') ).to be_a( Ezmlm::List::Author ) |
|
342 |
end |
|
343 |
||
16
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
344 |
it 'fetches author objects by email address' do |
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
345 |
author = list.author( 'ojjhjlapnejjlbcplabi' ) |
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
346 |
expect( list.author('yvette@example.net').name ).to eq( author.name ) |
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
347 |
end |
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
348 |
|
15 | 349 |
|
350 |
context 'fetching messages' do |
|
351 |
it 'raises an error if archiving is disabled' do |
|
352 |
expect( list ).to receive( :archived? ).and_return( false ) |
|
353 |
expect { |
|
354 |
list.message( 1 ) |
|
355 |
}.to raise_error( RuntimeError, /archiving is not enabled/i ) |
|
356 |
end |
|
357 |
||
358 |
it 'raises an error if the message archive is empty' do |
|
359 |
expect( list ).to receive( :message_count ).and_return( 0 ) |
|
360 |
expect { |
|
361 |
list.message( 1 ) |
|
362 |
}.to raise_error( RuntimeError, /message archive is empty/i ) |
|
363 |
end |
|
364 |
||
365 |
it 'returns an archived message' do |
|
366 |
message = list.message( 1 ) |
|
367 |
expect( message.id ).to be( 1 ) |
|
368 |
expect( message.subject ).to match( /compress program/ ) |
|
369 |
end |
|
370 |
||
371 |
it 'can iterate across all messages' do |
|
372 |
message = nil |
|
373 |
list.each_message do |m| |
|
374 |
if m.id == 20 |
|
375 |
message = m |
|
376 |
break |
|
377 |
end |
|
378 |
end |
|
379 |
expect( message ).to_not be_nil |
|
380 |
expect( message.id ).to be( 20 ) |
|
381 |
end |
|
382 |
end |
|
14 | 383 |
end |
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
384 |