spec/ezmlm/list/thread_spec.rb
changeset 17 23c7f5c8ee39
parent 15 a38e6916504c
equal deleted inserted replaced
16:e135ccae6783 17:23c7f5c8ee39
    27 				described_class.new( true, 1 )
    27 				described_class.new( true, 1 )
    28 			}.to raise_error( ArgumentError, /unknown list/i )
    28 			}.to raise_error( ArgumentError, /unknown list/i )
    29 		end
    29 		end
    30 
    30 
    31 		it 'raises error if thread indexing is disabled' do
    31 		it 'raises error if thread indexing is disabled' do
    32 			expect( list ).to receive( :threaded? ).and_return( false )
    32 			expect( list ).to receive( :archived? ).and_return( false )
    33 			expect {
    33 			expect {
    34 				described_class.new( list, thread_id )
    34 				described_class.new( list, thread_id )
    35 			}.to raise_error( RuntimeError, /indexing is not enabled/i )
    35 			}.to raise_error( RuntimeError, /archiving is not enabled/i )
    36 		end
    36 		end
    37 
    37 
    38 		it 'raises error if passed a malformed thread ID' do
    38 		it 'raises error if passed a malformed thread ID' do
    39 			expect {
    39 			expect {
    40 				described_class.new( list, 'whatever' )
    40 				described_class.new( list, 'whatever' )
    41 			}.to raise_error( ArgumentError, /malformed/i )
    41 			}.to raise_error( ArgumentError, /malformed/i )
    42 		end
    42 		end
    43 
    43 
    44 		it 'raises error when unable to read thread file' do
    44 		it 'raises error when unable to read thread file' do
    45 			allow( list ).to receive( :listdir ).and_return( Pathname('/nope') )
    45 			allow( list ).to receive( :listdir ).and_return( Pathname('/nope') )
    46 			expect( list ).to receive( :threaded? ).and_return( true )
    46 			expect( list ).to receive( :archived? ).and_return( true )
    47 			expect {
    47 			expect {
    48 				described_class.new( list, thread_id )
    48 				described_class.new( list, thread_id )
    49 			}.to raise_error( RuntimeError, /unknown thread/i )
    49 			}.to raise_error( RuntimeError, /unknown thread/i )
    50 		end
    50 		end
    51 
    51