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