spec/ezmlm/list_spec.rb
author Mahlon E. Smith <mahlon@martini.nu>
Wed, 01 Feb 2017 15:35:35 -0800
changeset 12 3cc813140c80
parent 6 66beb495a861
child 14 cba9fb39bcdb
permissions -rw-r--r--
First round of modernizing after a long absence. Much work to be done.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     1
#!/usr/bin/env ruby
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     2
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     3
BEGIN {
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     4
	require 'pathname'
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     5
	basedir = Pathname.new( __FILE__ ).dirname.parent.parent
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     6
	libdir = basedir + "lib"
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     7
	$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     8
}
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     9
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    10
require_relative '../spec_helpers'
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    11
require 'ezmlm'
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    12
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    13
describe Ezmlm::List do
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
    14
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    15
	# Testing constants
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    16
	TEST_LISTDIR               = Pathname.new( 'list' )
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    17
	TEST_LIST_NAME             = 'waffle-lovers'
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    18
	TEST_LIST_HOST             = 'lists.syrup.info'
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    19
	TEST_OWNER                 = 'listowner@rumpus-the-whale.info'
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    20
	TEST_CUSTOM_MODERATORS_DIR = '/foo/bar/clowns'
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    21
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    22
	TEST_SUBSCRIBERS = %w[
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    23
		pete.chaffee@toadsmackers.com
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    24
		dolphinzombie@alahalohamorra.com
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    25
		piratebanker@yahoo.com
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    26
	  ]
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    27
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    28
	TEST_MODERATORS = %w[
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    29
		dolphinzombie@alahalohamorra.com
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    30
	  ]
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    31
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    32
	TEST_CONFIG = <<-"EOF".gsub( /^\t+/, '' )
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    33
		F:-aBCDeFGHijKlMnOpQrStUVWXYZ
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    34
		X:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    35
		D:/var/qmail/alias/lists/waffle-lovers/
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    36
		T:/var/qmail/alias/.qmail-waffle-lovers
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    37
		L:#{TEST_LIST_NAME}
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    38
		H:#{TEST_LIST_HOST}
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    39
		C:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    40
		0:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    41
		3:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    42
		4:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    43
		5:#{TEST_OWNER}
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    44
		6:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    45
		7:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    46
		8:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    47
		9:
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    48
	EOF
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    49
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    50
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    51
	it "can create a list"
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    52
	it "can add a new subscriber"
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    53
	it "can remove a current subscriber"
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    54
	it "can edit the list's text files"
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    55
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    56
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    57
	###
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    58
	### List manager functions
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    59
	###
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    60
	describe "list manager functions" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    61
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    62
		before( :each ) do
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
    63
			@listpath = TEST_LISTDIR.dup
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    64
			@list = Ezmlm::List.new( @listpath )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    65
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    66
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    67
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    68
		it "can return the configured list name" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    69
			allow(@list).to receive( :config ).and_return({ 'L' => :the_list_name })
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    70
			expect(@list.name).to eq(:the_list_name)
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    71
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    72
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    73
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    74
		it "can return the configured list host" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    75
			allow(@list).to receive( :config ).and_return({ 'H' => :the_list_host })
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    76
			expect(@list.host).to eq(:the_list_host)
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    77
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    78
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    79
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    80
		it "can return the configured list address" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    81
			allow(@list).to receive( :config ).and_return({ 'L' => TEST_LIST_NAME, 'H' => TEST_LIST_HOST })
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    82
			expect(@list.address).to eq("%s@%s" % [ TEST_LIST_NAME, TEST_LIST_HOST ])
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    83
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    84
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    85
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    86
		CONFIG_KEYS = %w[ F X D T L H C 0 3 4 5 6 7 8 9 ]
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    87
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    88
		it "can fetch the list config as a Hash" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    89
			config_path = double( "Mock config path" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    90
			expect(@listpath).to receive( :+ ).with( 'config' ).and_return( config_path )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    91
			expect(config_path).to receive( :exist? ).and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    92
			expect(config_path).to receive( :read ).and_return( TEST_CONFIG )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    93
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    94
			expect(@list.config).to be_an_instance_of( Hash )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    95
			expect(@list.config.size).to eq(CONFIG_KEYS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    96
			expect(@list.config.keys).to include( *CONFIG_KEYS )
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    97
		end
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    98
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    99
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   100
		it "raises an error if the list config file doesn't exist" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   101
			config_path = double( "Mock config path" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   102
			expect(@listpath).to receive( :+ ).with( 'config' ).and_return( config_path )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   103
			expect(config_path).to receive( :exist? ).and_return( false )
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   104
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   105
			expect {
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   106
				@list.config
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   107
			}.to raise_error( RuntimeError, /does not exist/ )
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   108
		end
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   109
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   110
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   111
		it "can return a list of subscribers' email addresses" do
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
   112
			subscribers_dir = TEST_LISTDIR + 'subscribers'
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   113
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   114
			expectation = expect(Pathname).to receive( :glob ).with( subscribers_dir + '*' )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   115
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   116
			TEST_SUBSCRIBERS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   117
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   118
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   119
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   120
				expectation.and_yield( mock_subfile )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   121
			end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   122
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   123
			subscribers = @list.subscribers
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   124
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   125
			expect(subscribers.size).to eq(TEST_SUBSCRIBERS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   126
			expect(subscribers).to include( *TEST_SUBSCRIBERS )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   127
		end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   128
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   129
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   130
		### Subscriber moderation
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   131
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   132
		it "knows that subscription moderation is enabled if the dir/modsub file exists" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   133
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   134
			expect(@listpath).to receive( :+ ).with( 'modsub' ).and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   135
			expect(modsub_path_obj).to receive( :exist? ).and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   136
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   137
			expect(@list).to be_closed()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   138
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   139
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   140
		it "knows that subscription moderation is enabled if the dir/remote file exists" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   141
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   142
			expect(@listpath).to receive( :+ ).with( 'modsub' ).and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   143
			expect(modsub_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   144
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   145
			remote_path_obj = double( "Mock 'remote' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   146
			expect(@listpath).to receive( :+ ).with( 'remote' ).and_return( remote_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   147
			expect(remote_path_obj).to receive( :exist? ).and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   148
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   149
			expect(@list).to be_closed()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   150
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   151
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   152
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   153
		it "knows that subscription moderation is disabled if neither the dir/modsub nor " +
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   154
		   "dir/remote files exist" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   155
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   156
			expect(@listpath).to receive( :+ ).with( 'modsub' ).and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   157
			expect(modsub_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   158
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   159
			remote_path_obj = double( "Mock 'remote' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   160
			expect(@listpath).to receive( :+ ).with( 'remote' ).and_return( remote_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   161
			expect(remote_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   162
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   163
			expect(@list).not_to be_closed()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   164
		end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   165
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   166
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   167
		it "returns an empty array of subscription moderators for an open list" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   168
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   169
			expect(@listpath).to receive( :+ ).with( 'modsub' ).and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   170
			expect(modsub_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   171
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   172
			remote_path_obj = double( "Mock 'remote' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   173
			expect(@listpath).to receive( :+ ).with( 'remote' ).and_return( remote_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   174
			expect(remote_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   175
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   176
			expect(@list.subscription_moderators).to be_empty()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   177
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   178
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   179
		it "can return a list of subscription moderators' email addresses" do
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   180
			# Test the moderation config files for existence
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   181
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   182
			expect(@listpath).to receive( :+ ).with( 'modsub' ).twice.and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   183
			expect(modsub_path_obj).to receive( :exist? ).twice.and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   184
			remote_path_obj = double( "Mock 'remote' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   185
			expect(@listpath).to receive( :+ ).with( 'remote' ).and_return( remote_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   186
			expect(remote_path_obj).to receive( :exist? ).once.and_return( true )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   187
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   188
			# Try to read directory names from both config files
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   189
			expect(modsub_path_obj).to receive( :read ).with( 1 ).and_return( nil )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   190
			expect(remote_path_obj).to receive( :read ).with( 1 ).and_return( nil )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   191
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   192
			# Read subscribers from the default directory
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   193
			subscribers_dir = double( "Mock moderator subscribers directory" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   194
			expect(@listpath).to receive( :+ ).with( 'mod/subscribers' ).and_return( subscribers_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   195
			expect(subscribers_dir).to receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   196
			expectation = expect(Pathname).to receive( :glob ).with( :mod_sub_dir )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   197
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   198
			TEST_MODERATORS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   199
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   200
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   201
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   202
				expectation.and_yield( mock_subfile )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   203
			end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   204
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   205
			mods = @list.subscription_moderators
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   206
			expect(mods.size).to eq(TEST_MODERATORS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   207
			expect(mods).to include( *TEST_MODERATORS )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   208
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   209
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   210
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   211
		it "can return a list of subscription moderators' email addresses when the moderators " +
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   212
		   "directory has been customized" do
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   213
			# Test the moderation config files for existence
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   214
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   215
			expect(@listpath).to receive( :+ ).with( 'modsub' ).twice.and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   216
			expect(modsub_path_obj).to receive( :exist? ).twice.and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   217
			expect(@listpath).to receive( :+ ).with( 'remote' )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   218
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   219
			# Try to read directory names from both config files
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   220
			expect(modsub_path_obj).to receive( :read ).with( 1 ).and_return( '/' )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   221
			expect(modsub_path_obj).to receive( :read ).with().and_return( TEST_CUSTOM_MODERATORS_DIR )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   222
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   223
			custom_mod_path = double( "Mock path object for customized moderator dir" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   224
			expect(Pathname).to receive( :new ).with( TEST_CUSTOM_MODERATORS_DIR ).and_return( custom_mod_path )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   225
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   226
			# Read subscribers from the default file
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   227
			expect(custom_mod_path).to receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   228
			expectation = expect(Pathname).to receive( :glob ).with( :mod_sub_dir )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   229
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   230
			TEST_MODERATORS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   231
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   232
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   233
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   234
				expectation.and_yield( mock_subfile )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   235
			end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   236
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   237
			mods = @list.subscription_moderators
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   238
			expect(mods.size).to eq(TEST_MODERATORS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   239
			expect(mods).to include( *TEST_MODERATORS )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   240
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   241
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   242
		it "can get a list of modererators when remote subscription moderation is enabled" +
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   243
           " and the modsub configuration is empty" do
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   244
			# Test the moderation config files for existence
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   245
			modsub_path_obj = double( "Mock 'modsub' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   246
			expect(@listpath).to receive( :+ ).with( 'modsub' ).twice.and_return( modsub_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   247
			expect(modsub_path_obj).to receive( :exist? ).twice.and_return( false )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   248
            remote_path_obj = double( "Mock 'remote' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   249
			expect(@listpath).to receive( :+ ).with( 'remote' ).twice.and_return( remote_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   250
            expect(remote_path_obj).to receive( :exist? ).twice.and_return( true )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   251
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   252
			# Try to read directory names from both config files
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   253
			expect(remote_path_obj).to receive( :read ).with( 1 ).and_return( '/' )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   254
			expect(remote_path_obj).to receive( :read ).with().and_return( TEST_CUSTOM_MODERATORS_DIR )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   255
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   256
			custom_mod_path = double( "Mock path object for customized moderator dir" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   257
			expect(Pathname).to receive( :new ).with( TEST_CUSTOM_MODERATORS_DIR ).and_return( custom_mod_path )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   258
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   259
			# Read subscribers from the default file
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   260
			expect(custom_mod_path).to receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   261
			expectation = expect(Pathname).to receive( :glob ).with( :mod_sub_dir )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   262
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   263
			TEST_MODERATORS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   264
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   265
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   266
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   267
				expectation.and_yield( mock_subfile )
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   268
			end
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   269
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   270
			mods = @list.subscription_moderators
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   271
			expect(mods.size).to eq(TEST_MODERATORS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   272
			expect(mods).to include( *TEST_MODERATORS )
3
9b9e85ccf4f9 Add a test for a customized moderator's directory in the dir/remote file.
Michael Granger <mgranger@laika.com>
parents: 2
diff changeset
   273
		end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   274
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   275
		### Message moderation
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   276
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   277
		it "knows that subscription moderation is enabled if the dir/modpost file exists" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   278
			modpost_path_obj = double( "Mock 'modpost' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   279
			expect(@listpath).to receive( :+ ).with( 'modpost' ).and_return( modpost_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   280
			expect(modpost_path_obj).to receive( :exist? ).and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   281
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   282
			expect(@list).to be_moderated()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   283
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   284
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   285
		it "knows that subscription moderation is disabled if the dir/modpost file doesn't exist" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   286
			modpost_path_obj = double( "Mock 'modpost' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   287
			expect(@listpath).to receive( :+ ).with( 'modpost' ).and_return( modpost_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   288
			expect(modpost_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   289
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   290
			expect(@list).not_to be_moderated()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   291
		end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   292
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   293
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   294
		it "returns an empty array of message moderators for an open list" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   295
			modpost_path_obj = double( "Mock 'modpost' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   296
			expect(@listpath).to receive( :+ ).with( 'modpost' ).and_return( modpost_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   297
			expect(modpost_path_obj).to receive( :exist? ).and_return( false )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   298
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   299
			expect(@list.message_moderators).to be_empty()
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   300
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   301
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   302
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   303
		it "can return a list of message moderators' email addresses" do
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   304
			# Test the moderation config file for existence
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   305
			modpost_path_obj = double( "Mock 'modpost' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   306
			expect(@listpath).to receive( :+ ).with( 'modpost' ).twice.and_return( modpost_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   307
			expect(modpost_path_obj).to receive( :exist? ).twice.and_return( true )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   308
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   309
			# Try to read directory names from the config file
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   310
			expect(modpost_path_obj).to receive( :read ).with( 1 ).and_return( nil )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   311
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   312
			# Read subscribers from the default directory
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   313
			subscribers_dir = double( "Mock moderator subscribers directory" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   314
			expect(@listpath).to receive( :+ ).with( 'mod/subscribers' ).and_return( subscribers_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   315
			expect(subscribers_dir).to receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   316
			expectation = expect(Pathname).to receive( :glob ).with( :mod_sub_dir )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   317
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   318
			TEST_MODERATORS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   319
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   320
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   321
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   322
				expectation.and_yield( mock_subfile )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   323
			end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   324
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   325
			mods = @list.message_moderators
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   326
			expect(mods.size).to eq(TEST_MODERATORS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   327
			expect(mods).to include( *TEST_MODERATORS )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   328
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   329
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   330
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   331
		it "can return a list of message moderators' email addresses when the moderators " +
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   332
		   "directory has been customized" do
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   333
			# Test the moderation config files for existence
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   334
			modpost_path_obj = double( "Mock 'modpost' path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   335
			expect(@listpath).to receive( :+ ).with( 'modpost' ).twice.and_return( modpost_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   336
			expect(modpost_path_obj).to receive( :exist? ).twice.and_return( true )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   337
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   338
			# Try to read directory names from both config files
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   339
			expect(modpost_path_obj).to receive( :read ).with( 1 ).and_return( '/' )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   340
			expect(modpost_path_obj).to receive( :read ).with().and_return( TEST_CUSTOM_MODERATORS_DIR )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   341
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   342
			custom_mod_path = double( "Mock path object for customized moderator dir" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   343
			expect(Pathname).to receive( :new ).with( TEST_CUSTOM_MODERATORS_DIR ).and_return( custom_mod_path )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   344
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   345
			# Read subscribers from the default file
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   346
			expect(custom_mod_path).to receive( :+ ).with( '*' ).and_return( :mod_sub_dir )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   347
			expectation = expect(Pathname).to receive( :glob ).with( :mod_sub_dir )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   348
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   349
			TEST_MODERATORS.each do |email|
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   350
				mock_subfile = double( "Mock subscribers file for '#{email}'" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   351
				expect(mock_subfile).to receive( :read ).and_return( "T#{email}\0" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   352
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   353
				expectation.and_yield( mock_subfile )
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   354
			end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   355
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   356
			mods = @list.message_moderators
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   357
			expect(mods.size).to eq(TEST_MODERATORS.length)
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   358
			expect(mods).to include( *TEST_MODERATORS )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   359
		end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   360
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   361
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   362
		### List owner
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   363
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   364
		it "returns nil when the list doesn't have an owner in its config" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   365
			allow(@list).to receive( :config ).and_return({ '5' => nil })
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   366
			expect(@list.owner).to eq(nil)
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   367
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   368
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   369
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   370
		it "can return the email address of the list owner" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   371
			allow(@list).to receive( :config ).and_return({ '5' => TEST_OWNER })
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   372
			expect(@list.owner).to eq(TEST_OWNER)
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   373
		end
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   374
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   375
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   376
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   377
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   378
	###
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   379
	### Archive functions
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   380
	###
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   381
	describe "archive functions" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   382
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   383
		before( :each ) do
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
   384
			@listpath = TEST_LISTDIR.dup
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   385
			@list = Ezmlm::List.new( @listpath )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   386
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   387
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   388
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   389
		it "can return the count of archived posts" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   390
			numpath_obj = double( "num file path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   391
			expect(@listpath).to receive( :+ ).with( 'num' ).and_return( numpath_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   392
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   393
			expect(numpath_obj).to receive( :exist? ).and_return( true )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   394
			expect(numpath_obj).to receive( :read ).and_return( "1723:123123123" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   395
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   396
			expect(@list.message_count).to eq(1723)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   397
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   398
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   399
		it "can return the count of archived posts to a list that hasn't been posted to" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   400
			numpath_obj = double( "num file path object" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   401
			expect(@listpath).to receive( :+ ).with( 'num' ).and_return( numpath_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   402
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   403
			expect(numpath_obj).to receive( :exist? ).and_return( false )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   404
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   405
			expect(@list.message_count).to eq(0)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   406
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   407
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   408
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   409
6
66beb495a861 Checkpoint commit.
Michael Granger <mgranger@laika.com>
parents: 5
diff changeset
   410
		TEST_ARCHIVE_DIR = TEST_LISTDIR + 'archive'
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   411
		TEST_ARCHIVE_SUBDIRS = %w[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ]
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   412
		TEST_POST_FILES = %w[ 00 01 02 03 04 05 06 07 08 09 10 11 12 13 ]
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   413
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   414
		before( :each ) do
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   415
			@archive_dir = TEST_ARCHIVE_DIR.dup
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   416
			@archive_subdirs = TEST_ARCHIVE_SUBDIRS.dup
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   417
			@archive_subdir_paths = TEST_ARCHIVE_SUBDIRS.collect {|pn| TEST_ARCHIVE_DIR + pn }
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
   418
			@archive_post_paths = TEST_POST_FILES.collect {|pn|
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   419
				TEST_ARCHIVE_DIR + TEST_ARCHIVE_SUBDIRS.last + pn
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   420
			  }
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   421
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   422
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   423
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   424
		it "can return a TMail::Mail object parsed from the last archived post" do
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   425
			# need to find the last message
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   426
			archive_path_obj = double( "archive path" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   427
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   428
			expect(@listpath).to receive( :+ ).with( 'archive' ).and_return( archive_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   429
			expect(archive_path_obj).to receive( :exist? ).and_return( true )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   430
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   431
			# Find the last numbered directory under the archive dir
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   432
			expect(archive_path_obj).to receive( :+ ).with( '[0-9]*' ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   433
				and_return( :archive_dir_globpath )
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   434
			expect(Pathname).to receive( :glob ).with( :archive_dir_globpath ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   435
				and_return( @archive_subdir_paths )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   436
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   437
			# Find the last numbered file under the last numbered directory we found
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   438
			# above.
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   439
			expect(@archive_subdir_paths.last).to receive( :+ ).with( '[0-9]*' ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   440
				and_return( :archive_post_pathglob )
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   441
			expect(Pathname).to receive( :glob ).with( :archive_post_pathglob ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   442
				and_return( @archive_post_paths )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   443
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   444
			expect(TMail::Mail).to receive( :load ).with( @archive_post_paths.last.to_s ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   445
				and_return( :mail_object )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   446
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   447
			expect(@list.last_post).to eq(:mail_object)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   448
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   449
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   450
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   451
		it "returns nil for the last post if there is no archive directory for the list" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   452
			archive_path_obj = double( "archive path" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   453
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   454
			expect(@listpath).to receive( :+ ).with( 'archive' ).and_return( archive_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   455
			expect(archive_path_obj).to receive( :exist? ).and_return( false )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   456
			expect(@list.last_post).to eq(nil)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   457
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   458
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   459
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   460
		it "returns nil for the last post if there haven't been any posts to the list" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   461
			archive_path_obj = double( "archive path" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   462
			mail_object = double( "Mock TMail object" )
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   463
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   464
			expect(@listpath).to receive( :+ ).with( 'archive' ).and_return( archive_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   465
			expect(archive_path_obj).to receive( :exist? ).and_return( true )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   466
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   467
			# Find the last numbered directory under the archive dir
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   468
			expect(archive_path_obj).to receive( :+ ).with( '[0-9]*' ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   469
				and_return( :archive_dir_globpath )
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   470
			expect(Pathname).to receive( :glob ).with( :archive_dir_globpath ).and_return( [] )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   471
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   472
			expect(@list.last_post).to eq(nil)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   473
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   474
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   475
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   476
		it "raises a RuntimeError if the last archive directory doesn't have any messages in it" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   477
			archive_path_obj = double( "archive path" )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   478
			mail_object = double( "Mock TMail object" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   479
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   480
			expect(@listpath).to receive( :+ ).with( 'archive' ).and_return( archive_path_obj )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   481
			expect(archive_path_obj).to receive( :exist? ).and_return( true )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   482
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   483
			# Find the last numbered directory under the archive dir
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   484
			expect(archive_path_obj).to receive( :+ ).with( '[0-9]*' ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   485
				and_return( :archive_dir_globpath )
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   486
			expect(Pathname).to receive( :glob ).with( :archive_dir_globpath ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   487
				and_return( @archive_subdir_paths )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   488
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   489
			expect(@archive_subdir_paths.last).to receive( :+ ).with( '[0-9]*' ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   490
				and_return( :archive_post_pathglob )
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   491
			expect(Pathname).to receive( :glob ).with( :archive_post_pathglob ).
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   492
				and_return( [] )
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   493
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   494
			expect {
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   495
				@list.last_post
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   496
			}.to raise_error( RuntimeError, /unexpectedly empty/i )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   497
		end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   498
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   499
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   500
		it "can fetch the date of the last archived post" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   501
			mail_object = double( "Mock TMail object" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   502
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   503
			expect(@list).to receive( :last_post ).and_return( mail_object )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   504
			expect(mail_object).to receive( :date ).and_return( :the_message_date )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   505
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   506
			expect(@list.last_message_date).to eq(:the_message_date)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   507
		end
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   508
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   509
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   510
		it "can fetch the date of the last archived post" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   511
			mail_object = double( "Mock TMail object" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   512
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   513
			expect(@list).to receive( :last_post ).and_return( mail_object )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   514
			expect(mail_object).to receive( :date ).and_return( :the_message_date )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   515
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   516
			expect(@list.last_message_date).to eq(:the_message_date)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   517
		end
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   518
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   519
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   520
		it "can fetch the author of the last archived post" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   521
			mail_object = double( "Mock TMail object" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   522
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   523
			expect(@list).to receive( :last_post ).and_return( mail_object )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   524
			expect(mail_object).to receive( :from ).and_return( :the_message_author )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   525
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   526
			expect(@list.last_message_author).to eq(:the_message_author)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   527
		end
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   528
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   529
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   530
		it "can fetch the subject of the last archived post" do
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   531
			mail_object = double( "Mock TMail object" )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   532
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   533
			expect(@list).to receive( :last_post ).and_return( mail_object )
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   534
			expect(mail_object).to receive( :from ).and_return( :the_message_author )
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   535
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   536
			expect(@list.last_message_author).to eq(:the_message_author)
4
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   537
		end
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   538
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   539
	end
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   540
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   541
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   542
	it "can fetch the body of an archived post by message id"
8c4ae0797d5f Added more archive-related functions:
Michael Granger <mgranger@laika.com>
parents: 3
diff changeset
   543
	it "can fetch the header of an archived post by message id"
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   544
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   545
	it "can return a hash of the subjects of all archived posts to message ids"
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   546
	it "can return an Array of the subjects of all archived posts"
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   547
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   548
	it "can return a hash of the threads of all archived posts to message ids"
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   549
	it "can return an Array of the threads of all archived posts"
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   550
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   551
	it "can return a hash of the authors of all archived posts to message ids"
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   552
	it "can return an Array of the authors of all archived posts"
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   553
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
   554
end
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
   555
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
   556