spec/ezmlm/list_spec.rb
changeset 3 9b9e85ccf4f9
parent 2 7b5a0131d5cd
child 4 8c4ae0797d5f
equal deleted inserted replaced
2:7b5a0131d5cd 3:9b9e85ccf4f9
   187 			mods = @list.subscription_moderators
   187 			mods = @list.subscription_moderators
   188 			mods.should have(TEST_MODERATORS.length).members
   188 			mods.should have(TEST_MODERATORS.length).members
   189 			mods.should include( *TEST_MODERATORS )
   189 			mods.should include( *TEST_MODERATORS )
   190 		end
   190 		end
   191 		
   191 		
       
   192 		it "can get a list of modererators when remote subscription moderation is enabled" +
       
   193            " and the modsub configuration is empty" do
       
   194 			# Test the moderation config files for existence
       
   195 			modsub_path_obj = mock( "Mock 'modsub' path object" )
       
   196 			@listpath.should_receive( :+ ).with( 'modsub' ).twice.and_return( modsub_path_obj )
       
   197 			modsub_path_obj.should_receive( :exist? ).twice.and_return( false )
       
   198             remote_path_obj = mock( "Mock 'remote' path object" )
       
   199 			@listpath.should_receive( :+ ).with( 'remote' ).twice.and_return( remote_path_obj )
       
   200             remote_path_obj.should_receive( :exist? ).twice.and_return( true )
       
   201 
       
   202 			# Try to read directory names from both config files
       
   203 			remote_path_obj.should_receive( :read ).with( 1 ).and_return( '/' )
       
   204 			remote_path_obj.should_receive( :read ).with().and_return( TEST_CUSTOM_MODERATORS_DIR )
       
   205 
       
   206 			custom_mod_path = mock( "Mock path object for customized moderator dir" )
       
   207 			Pathname.should_receive( :new ).with( TEST_CUSTOM_MODERATORS_DIR ).and_return( custom_mod_path )
       
   208 
       
   209 			# Read subscribers from the default file
       
   210 			custom_mod_path.should_receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
       
   211 			expectation = Pathname.should_receive( :glob ).with( :mod_sub_dir )
       
   212 
       
   213 			TEST_MODERATORS.each do |email|
       
   214 				mock_subfile = mock( "Mock subscribers file for '#{email}'" )
       
   215 				mock_subfile.should_receive( :read ).and_return( "T#{email}\0" )
       
   216 
       
   217 				expectation.and_yield( mock_subfile )
       
   218 			end
       
   219 
       
   220 			mods = @list.subscription_moderators
       
   221 			mods.should have(TEST_MODERATORS.length).members
       
   222 			mods.should include( *TEST_MODERATORS )
       
   223 		end
   192 
   224 
   193 		### Message moderation
   225 		### Message moderation
   194 		
   226 		
   195 		it "knows that subscription moderation is enabled if the dir/modpost file exists" do
   227 		it "knows that subscription moderation is enabled if the dir/modpost file exists" do
   196 			modpost_path_obj = mock( "Mock 'modpost' path object" )
   228 			modpost_path_obj = mock( "Mock 'modpost' path object" )