108 |
108 |
109 it "can remove a allowed address" do |
109 it "can remove a allowed address" do |
110 list.add_allowed( *TEST_MODERATORS ) |
110 list.add_allowed( *TEST_MODERATORS ) |
111 list.remove_allowed( TEST_MODERATORS.first ) |
111 list.remove_allowed( TEST_MODERATORS.first ) |
112 expect( list.allowed ).to be_empty |
112 expect( list.allowed ).to be_empty |
113 end |
|
114 |
|
115 |
|
116 it 'returns the current threading state' do |
|
117 expect( list.threaded? ).to be_truthy |
|
118 end |
|
119 |
|
120 it 'can set the threading state' do |
|
121 list.threaded = false |
|
122 expect( list.threaded? ).to be_falsey |
|
123 end |
113 end |
124 |
114 |
125 |
115 |
126 it 'returns the current public/private state' do |
116 it 'returns the current public/private state' do |
127 expect( list.public? ).to be_truthy |
117 expect( list.public? ).to be_truthy |
198 end |
188 end |
199 |
189 |
200 |
190 |
201 it 'can set archival status' do |
191 it 'can set archival status' do |
202 expect( list.archived? ).to be_truthy |
192 expect( list.archived? ).to be_truthy |
203 list.archive = false |
193 list.archived = false |
204 expect( list.archived? ).to be_falsey |
194 expect( list.archived? ).to be_falsey |
205 list.archive = true |
195 list.archived = true |
206 expect( list.archived? ).to be_truthy |
196 expect( list.archived? ).to be_truthy |
207 end |
197 end |
208 |
198 |
209 |
199 |
210 it 'can limit archive access to moderators only' do |
200 it 'can limit archive access to moderators only' do |
334 |
324 |
335 it 'fetches thread objects upon request' do |
325 it 'fetches thread objects upon request' do |
336 expect( list.thread('cadgeokhhaieijmndokb') ).to be_a( Ezmlm::List::Thread ) |
326 expect( list.thread('cadgeokhhaieijmndokb') ).to be_a( Ezmlm::List::Thread ) |
337 end |
327 end |
338 |
328 |
|
329 it 'returns nil when fetching an invalid thread' do |
|
330 expect( list.thread('whatever') ).to be_nil |
|
331 end |
|
332 |
339 |
333 |
340 it 'fetches author objects upon request' do |
334 it 'fetches author objects upon request' do |
341 expect( list.author('ojjhjlapnejjlbcplabi') ).to be_a( Ezmlm::List::Author ) |
335 expect( list.author('ojjhjlapnejjlbcplabi') ).to be_a( Ezmlm::List::Author ) |
342 end |
336 end |
343 |
337 |
344 it 'fetches author objects by email address' do |
338 it 'fetches author objects by email address' do |
345 author = list.author( 'ojjhjlapnejjlbcplabi' ) |
339 author = list.author( 'ojjhjlapnejjlbcplabi' ) |
346 expect( list.author('yvette@example.net').name ).to eq( author.name ) |
340 expect( list.author('yvette@example.net').name ).to eq( author.name ) |
347 end |
341 end |
348 |
342 |
|
343 it 'returns nil when fetching an invalid author' do |
|
344 expect( list.author('whatever') ).to be_nil |
|
345 end |
|
346 |
349 |
347 |
350 context 'fetching messages' do |
348 context 'fetching messages' do |
351 it 'raises an error if archiving is disabled' do |
349 it 'returns nil if archiving is disabled' do |
352 expect( list ).to receive( :archived? ).and_return( false ) |
350 expect( list ).to receive( :archived? ).and_return( false ) |
353 expect { |
351 expect( list.message(1) ).to be_nil |
354 list.message( 1 ) |
352 end |
355 }.to raise_error( RuntimeError, /archiving is not enabled/i ) |
353 |
|
354 it 'returns nil when fetching an invalid message id' do |
|
355 expect( list.message(2389234) ).to be_nil |
356 end |
356 end |
357 |
357 |
358 it 'raises an error if the message archive is empty' do |
358 it 'raises an error if the message archive is empty' do |
359 expect( list ).to receive( :message_count ).and_return( 0 ) |
359 expect( list ).to receive( :message_count ).and_return( 0 ) |
360 expect { |
360 expect { |