Multiple changes.
- Remove the runtime dependency on rake-compiler. - Use #rb_str_new instead of #rb_str_new2, the hash character array isn't null terminated. - Add various safeguards for object instantiations. - Remove the 'threaded' options for messages, folding them into 'archived'. If archiving is enabled, so is threading. - Return nil for lookups from the list object instead of raising exceptions. - Open subject indexes with the proper encodings (thanks Michael Granger!) - Allow touching and unlinking files to operate on multiple paths at once, within a single safety() wrap.
This commit is contained in:
parent
c99bdfe747
commit
3871084daa
17 changed files with 257 additions and 110 deletions
|
|
@ -28,11 +28,11 @@ describe Ezmlm::List::Author do
|
|||
}.to raise_error( ArgumentError, /unknown list/i )
|
||||
end
|
||||
|
||||
it 'raises error if thread indexing is disabled' do
|
||||
expect( list ).to receive( :threaded? ).and_return( false )
|
||||
it 'raises error if thread archiving is disabled' do
|
||||
expect( list ).to receive( :archived? ).and_return( false )
|
||||
expect {
|
||||
described_class.new( list, author_id )
|
||||
}.to raise_error( RuntimeError, /indexing is not enabled/i )
|
||||
}.to raise_error( RuntimeError, /archiving is not enabled/i )
|
||||
end
|
||||
|
||||
it 'raises error if passed a malformed author ID' do
|
||||
|
|
@ -43,7 +43,7 @@ describe Ezmlm::List::Author do
|
|||
|
||||
it 'raises error when unable to read index file' do
|
||||
allow( list ).to receive( :listdir ).and_return( Pathname('/nope') )
|
||||
expect( list ).to receive( :threaded? ).and_return( true )
|
||||
expect( list ).to receive( :archived? ).and_return( true )
|
||||
expect {
|
||||
described_class.new( list, author_id )
|
||||
}.to raise_error( RuntimeError, /unknown author/i )
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ describe Ezmlm::List::Message do
|
|||
it 'raises error when unable to read message' do
|
||||
allow( list ).to receive( :listdir ).and_return( Pathname('/nope') )
|
||||
expect( list ).to receive( :message_count ).and_return( 1 )
|
||||
expect( list ).to receive( :archived? ).and_return( true )
|
||||
expect {
|
||||
described_class.new( list, 1 )
|
||||
}.to raise_error( RuntimeError, /unable to determine message path/i )
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ describe Ezmlm::List::Thread do
|
|||
end
|
||||
|
||||
it 'raises error if thread indexing is disabled' do
|
||||
expect( list ).to receive( :threaded? ).and_return( false )
|
||||
expect( list ).to receive( :archived? ).and_return( false )
|
||||
expect {
|
||||
described_class.new( list, thread_id )
|
||||
}.to raise_error( RuntimeError, /indexing is not enabled/i )
|
||||
}.to raise_error( RuntimeError, /archiving is not enabled/i )
|
||||
end
|
||||
|
||||
it 'raises error if passed a malformed thread ID' do
|
||||
|
|
@ -43,7 +43,7 @@ describe Ezmlm::List::Thread do
|
|||
|
||||
it 'raises error when unable to read thread file' do
|
||||
allow( list ).to receive( :listdir ).and_return( Pathname('/nope') )
|
||||
expect( list ).to receive( :threaded? ).and_return( true )
|
||||
expect( list ).to receive( :archived? ).and_return( true )
|
||||
expect {
|
||||
described_class.new( list, thread_id )
|
||||
}.to raise_error( RuntimeError, /unknown thread/i )
|
||||
|
|
|
|||
|
|
@ -113,16 +113,6 @@ describe Ezmlm::List do
|
|||
end
|
||||
|
||||
|
||||
it 'returns the current threading state' do
|
||||
expect( list.threaded? ).to be_truthy
|
||||
end
|
||||
|
||||
it 'can set the threading state' do
|
||||
list.threaded = false
|
||||
expect( list.threaded? ).to be_falsey
|
||||
end
|
||||
|
||||
|
||||
it 'returns the current public/private state' do
|
||||
expect( list.public? ).to be_truthy
|
||||
expect( list.private? ).to be_falsey
|
||||
|
|
@ -200,9 +190,9 @@ describe Ezmlm::List do
|
|||
|
||||
it 'can set archival status' do
|
||||
expect( list.archived? ).to be_truthy
|
||||
list.archive = false
|
||||
list.archived = false
|
||||
expect( list.archived? ).to be_falsey
|
||||
list.archive = true
|
||||
list.archived = true
|
||||
expect( list.archived? ).to be_truthy
|
||||
end
|
||||
|
||||
|
|
@ -336,6 +326,10 @@ describe Ezmlm::List do
|
|||
expect( list.thread('cadgeokhhaieijmndokb') ).to be_a( Ezmlm::List::Thread )
|
||||
end
|
||||
|
||||
it 'returns nil when fetching an invalid thread' do
|
||||
expect( list.thread('whatever') ).to be_nil
|
||||
end
|
||||
|
||||
|
||||
it 'fetches author objects upon request' do
|
||||
expect( list.author('ojjhjlapnejjlbcplabi') ).to be_a( Ezmlm::List::Author )
|
||||
|
|
@ -346,13 +340,19 @@ describe Ezmlm::List do
|
|||
expect( list.author('yvette@example.net').name ).to eq( author.name )
|
||||
end
|
||||
|
||||
it 'returns nil when fetching an invalid author' do
|
||||
expect( list.author('whatever') ).to be_nil
|
||||
end
|
||||
|
||||
|
||||
context 'fetching messages' do
|
||||
it 'raises an error if archiving is disabled' do
|
||||
it 'returns nil if archiving is disabled' do
|
||||
expect( list ).to receive( :archived? ).and_return( false )
|
||||
expect {
|
||||
list.message( 1 )
|
||||
}.to raise_error( RuntimeError, /archiving is not enabled/i )
|
||||
expect( list.message(1) ).to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil when fetching an invalid message id' do
|
||||
expect( list.message(2389234) ).to be_nil
|
||||
end
|
||||
|
||||
it 'raises an error if the message archive is empty' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue