spec/ezmlm_spec.rb
changeset 12 3cc813140c80
parent 6 66beb495a861
child 14 cba9fb39bcdb
--- a/spec/ezmlm_spec.rb	Fri Sep 05 23:58:48 2008 +0000
+++ b/spec/ezmlm_spec.rb	Wed Feb 01 15:35:35 2017 -0800
@@ -3,66 +3,50 @@
 BEGIN {
 	require 'pathname'
 	basedir = Pathname.new( __FILE__ ).dirname.parent
-	
 	libdir = basedir + "lib"
-	
 	$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
 }
 
-begin
-	require 'spec/runner'
-	require 'spec/lib/helpers'
-	require 'ezmlm'
-rescue LoadError
-	unless Object.const_defined?( :Gem )
-		require 'rubygems'
-		retry
-	end
-	raise
-end
-
+require_relative 'spec_helpers'
+require 'ezmlm'
 
 describe Ezmlm do
-	include Ezmlm::SpecHelpers
-
-	TEST_LISTSDIR = '/tmp/lists'
 
 	it "can fetch a list of all mailing list subdirectories beneath a given directory" do
-		file_entry = mock( "plain file" )
-		file_entry.should_receive( :directory? ).and_return( false )
+		file_entry = double( "plain file" )
+		expect( file_entry ).to receive( :directory? ).and_return( false )
 
-		nonexistant_mlentry = stub( "mailinglist path that doesn't exist", :exist? => false )
-		nonml_dir_entry = stub( "directory with no mailinglist file",
-		 	:directory? => true, :+ => nonexistant_mlentry )
+		nonexistant_mlentry = double( "mailinglist path that doesn't exist", :exist? => false )
+		nonml_dir_entry = double( "directory with no mailinglist file",
+			:directory? => true, :+ => nonexistant_mlentry )
 
-		existant_mlentry = stub( "mailinglist path that does exist", :exist? => true )
-		ml_dir_entry = stub( "directory with a mailinglist file", :directory? => true, :+ => existant_mlentry )
-		
-		Pathname.should_receive( :glob ).with( an_instance_of(Pathname) ).
+		existant_mlentry = double( "mailinglist path that does exist", :exist? => true )
+		ml_dir_entry = double( "directory with a mailinglist file", :directory? => true, :+ => existant_mlentry )
+
+		expect( Pathname ).to receive( :glob ).with( an_instance_of(Pathname) ).
 			and_return([ file_entry, nonml_dir_entry, ml_dir_entry ])
 
 		dirs = Ezmlm.find_directories( TEST_LISTSDIR )
-		
-		dirs.should have(1).member
-		dirs.should include( ml_dir_entry )
+
+		expect( dirs.size ).to eq( 1 )
+		expect( dirs ).to include( ml_dir_entry )
 	end
-	
+
 
 	it "can iterate over all mailing lists in a specified directory" do
-		Ezmlm.should_receive( :find_directories ).with( TEST_LISTSDIR ).and_return([ :listdir1, :listdir2 ])
+		expect( Ezmlm ).to receive( :find_directories ).with( TEST_LISTSDIR ).and_return([ :listdir1, :listdir2 ])
 
-		Ezmlm::List.should_receive( :new ).with( :listdir1 ).and_return( :listobject1 )
-		Ezmlm::List.should_receive( :new ).with( :listdir2 ).and_return( :listobject2 )
-		
+		expect( Ezmlm::List ).to receive( :new ).with( :listdir1 ).and_return( :listobject1 )
+		expect( Ezmlm::List ).to receive( :new ).with( :listdir2 ).and_return( :listobject2 )
+
 		lists = []
 		Ezmlm.each_list( TEST_LISTSDIR ) do |list|
 			lists << list
 		end
-		
-		lists.should have(2).members
-		lists.should include( :listobject1, :listobject2 )
+
+		expect( lists.size ).to eq(2)
+		expect( lists ).to include( :listobject1, :listobject2 )
 	end
-	
 end