spec/ezmlm/list_spec.rb
author Mahlon E. Smith <mahlon@laika.com>
Tue, 16 May 2017 15:52:05 -0700
changeset 20 9d59d30685cb
parent 17 23c7f5c8ee39
child 24 f8873b391f3d
permissions -rw-r--r--
Fixes for documentation and test directories that didn't make it into the repo.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
     1
# vim: set nosta noet ts=4 sw=4 ft=rspec:
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     2
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
     3
require_relative '../spec_helpers'
1
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     4
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     5
describe Ezmlm::List do
1d3cfd4837a8 Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff changeset
     6
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
     7
	before( :each ) do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
     8
		@listdir = make_listdir()
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
     9
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    10
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    11
	after( :each ) do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    12
		rm_r( @listdir )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    13
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    15
	let( :list ) do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    16
		described_class.new( @listdir )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    17
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    18
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    19
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    20
	it "returns the list name" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    21
		expect( list.name ).to eq( TEST_LIST_NAME )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    22
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    23
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    24
	it "returns the list host" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    25
		expect( list.host ).to eq( TEST_LIST_HOST )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    26
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    27
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    28
	it "returns the list address" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    29
		expect( list.address ).to eq( TEST_LIST_NAME + '@' + TEST_LIST_HOST )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    30
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    31
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    32
	it "returns nil if the list owner isn't an email address" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    33
		expect( list.owner ).to eq( nil )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    34
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    35
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    36
	it "returns an email address owner" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    37
		expect( list ).to receive( :read ).with( 'owner' ).and_return( TEST_OWNER )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    38
		expect( list.owner ).to eq( TEST_OWNER )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    39
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    40
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    41
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    42
	it "can add a new subscriber" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    43
		list.add_subscriber( *TEST_SUBSCRIBERS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    44
		expect( list.is_subscriber?( TEST_SUBSCRIBERS.first ) ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    45
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    46
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    47
	it "returns the list of subscibers" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    48
		list.add_subscriber( *TEST_SUBSCRIBERS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    49
		list.add_subscriber( 'notanemailaddress' )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    50
		expect( list.subscribers.length ).to eq( 3 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    51
		expect( list.subscribers ).to include( TEST_SUBSCRIBERS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    52
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    53
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    54
	it "can remove a current subscriber" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    55
		list.add_subscriber( *TEST_SUBSCRIBERS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    56
		list.remove_subscriber( 'notanemailaddress' )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    57
		list.remove_subscriber( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    58
		expect( list.subscribers.length ).to eq( 2 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    59
	end
5
804e1c2b9a40 * Added rdoc-generation to the cruise task and the artifacts that get saved
Michael Granger <mgranger@laika.com>
parents: 4
diff changeset
    60
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    61
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    62
	it "can add a new moderator" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    63
		list.add_moderator( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    64
		expect( list.is_moderator?( TEST_MODERATORS.first ) ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
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
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    67
	it "returns the list of moderators" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    68
		list.add_moderator( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    69
		expect( list.moderators.length ).to eq( 1 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    70
		expect( list.moderators ).to include( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
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
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    73
	it "can remove a current moderator" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    74
		list.add_moderator( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    75
		list.remove_moderator( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    76
		expect( list.moderators ).to be_empty
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    77
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    78
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    79
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    80
	it "can add a blacklisted address" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    81
		list.add_blacklisted( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    82
		expect( list.is_blacklisted?( TEST_MODERATORS.first ) ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    83
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    84
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
    85
	it "returns the list of blacklisted addresses" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    86
		list.add_blacklisted( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    87
		expect( list.blacklisted.length ).to eq( 1 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    88
		expect( list.blacklisted ).to include( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    89
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    90
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    91
	it "can remove a blacklisted address" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    92
		list.add_blacklisted( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    93
		list.remove_blacklisted( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    94
		expect( list.blacklisted ).to be_empty
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    95
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
    96
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
    97
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    98
	it "can add an allowed address" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
    99
		list.add_allowed( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   100
		expect( list.is_allowed?( TEST_MODERATORS.first ) ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   101
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   102
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   103
	it "returns the list of allowed addresses" do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   104
		list.add_allowed( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   105
		expect( list.allowed.length ).to eq( 1 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   106
		expect( list.allowed ).to include( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   107
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   108
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   109
	it "can remove a allowed address" do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   110
		list.add_allowed( *TEST_MODERATORS )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   111
		list.remove_allowed( TEST_MODERATORS.first )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   112
		expect( list.allowed ).to be_empty
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   113
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   114
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   115
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   116
	it 'returns the current public/private state' do
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   117
		expect( list.public? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   118
		expect( list.private? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   119
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   120
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   121
	it 'can set the privacy state' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   122
		list.public = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   123
		expect( list.public? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   124
		expect( list.private? ).to be_truthy
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   125
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   126
		list.private = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   127
		expect( list.private? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   128
		expect( list.public? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   129
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   130
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   131
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   132
	it 'can set the remote subscription state' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   133
		expect( list.remote_subscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   134
		list.remote_subscriptions = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   135
		expect( list.remote_subscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   136
		list.remote_subscriptions = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   137
		expect( list.remote_subscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   138
	end
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   139
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   140
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   141
	it 'can set subscription moderation state' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   142
		expect( list.moderated_subscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   143
		list.moderated_subscriptions = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   144
		expect( list.moderated_subscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   145
		list.moderated_subscriptions = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   146
		expect( list.moderated_subscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   147
	end
12
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
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   150
	it 'can set posting moderation state' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   151
		expect( list.moderated? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   152
		list.moderated = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   153
		expect( list.moderated? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   154
		list.moderated = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   155
		expect( list.moderated? ).to be_falsey
2
7b5a0131d5cd Added more list-config accessors
Michael Granger <mgranger@laika.com>
parents: 1
diff changeset
   156
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   157
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   158
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   159
	it 'can set moderation-only posting' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   160
		expect( list.moderator_posts_only? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   161
		list.moderator_posts_only = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   162
		expect( list.moderator_posts_only? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   163
		list.moderator_posts_only = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   164
		expect( list.moderator_posts_only? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   165
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   166
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   167
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   168
	it 'can set user-only posting' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   169
		expect( list.user_posts_only? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   170
		list.user_posts_only = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   171
		expect( list.user_posts_only? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   172
		list.user_posts_only = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   173
		expect( list.user_posts_only? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   174
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   175
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   176
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   177
	it 'user+moderation together sets non-subscriber moderation' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   178
		expect( list.user_posts_only? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   179
		expect( list.moderated? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   180
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   181
		list.moderated = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   182
		list.user_posts_only = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   183
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   184
		expect( list.listdir + 'noreturnposts' ).to exist
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   185
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   186
		list.moderated = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   187
		expect( list.listdir + 'noreturnposts' ).to_not exist
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   188
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   189
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   190
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   191
	it 'can set archival status' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   192
		expect( list.archived? ).to be_truthy
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   193
		list.archived = false
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   194
		expect( list.archived? ).to be_falsey
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   195
		list.archived = true
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   196
		expect( list.archived? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   197
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   198
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   199
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   200
	it 'can limit archive access to moderators only' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   201
		expect( list.private_archive? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   202
		list.private_archive = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   203
		expect( list.private_archive? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   204
		list.private_archive = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   205
		expect( list.private_archive? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   206
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   207
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   208
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   209
	it 'can limit archive access to list subscribers only' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   210
		expect( list.guarded_archive? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   211
		list.guarded_archive = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   212
		expect( list.guarded_archive? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   213
		list.guarded_archive = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   214
		expect( list.guarded_archive? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   215
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   216
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   217
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   218
	it 'can toggle digest status' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   219
		expect( list.digested? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   220
		list.digest = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   221
		expect( list.digested? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   222
		list.digest = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   223
		expect( list.digested? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   224
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   225
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   226
	it 'returns a default digest kbyte size' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   227
		expect( list.digest_kbytesize ).to eq( 64 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   228
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   229
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   230
	it 'can set a new digest kbyte size' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   231
		list.digest_kbytesize = 300
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   232
		expect( list.digest_kbytesize ).to eq( 300 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   233
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   234
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   235
	it 'returns a default digest message count' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   236
		expect( list.digest_count ).to eq( 10 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   237
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   238
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   239
	it 'can set a new digest message count' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   240
		list.digest_count = 25
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   241
		expect( list.digest_count ).to eq( 25 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   242
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   243
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   244
	it 'returns a default digest timeout' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   245
		expect( list.digest_timeout ).to eq( 48 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   246
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   247
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   248
	it 'can set a new digest timeout' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   249
		list.digest_timeout = 24
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   250
		expect( list.digest_timeout ).to eq( 24 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   251
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   252
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   253
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   254
	it 'can set subscription confirmation' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   255
		expect( list.confirm_subscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   256
		list.confirm_subscriptions = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   257
		expect( list.confirm_subscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   258
		list.confirm_subscriptions = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   259
		expect( list.confirm_subscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   260
	end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   261
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   262
	it 'can set unsubscription confirmation' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   263
		expect( list.confirm_unsubscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   264
		list.confirm_unsubscriptions = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   265
		expect( list.confirm_unsubscriptions? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   266
		list.confirm_unsubscriptions = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   267
		expect( list.confirm_unsubscriptions? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   268
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   269
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   270
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   271
	it 'can set message posting confirmation' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   272
		expect( list.confirm_postings? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   273
		list.confirm_postings = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   274
		expect( list.confirm_postings? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   275
		list.confirm_postings = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   276
		expect( list.confirm_postings? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   277
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   278
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   279
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   280
	it 'can toggle remote subscriber lists for moderators' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   281
		expect( list.allow_remote_listing? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   282
		list.allow_remote_listing = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   283
		expect( list.allow_remote_listing? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   284
		list.allow_remote_listing = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   285
		expect( list.allow_remote_listing? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   286
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   287
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   288
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   289
	it 'can toggle bounce management' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   290
		expect( list.bounce_warnings? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   291
		list.bounce_warnings = false
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   292
		expect( list.bounce_warnings? ).to be_falsey
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   293
		list.bounce_warnings = true
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   294
		expect( list.bounce_warnings? ).to be_truthy
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   295
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   296
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   297
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   298
	it 'returns a default max message size' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   299
		expect( list.maximum_message_size ).to eq( 0 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   300
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   301
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   302
	it 'can set a new max message size' do
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   303
		list.maximum_message_size = 1024 * 300
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   304
		expect( list.maximum_message_size ).to eq( 307200 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   305
	end
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   306
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   307
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   308
	it 'can return the total message count for a pristine list' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   309
		expect( list ).to receive( :read ).with( 'archnum' ).and_return( nil )
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   310
		expect( list.message_count ).to eq( 0 )
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   311
	end
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   312
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   313
	it 'can return the total message count for a list with deliveries' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   314
		expect( list.message_count ).to eq( 150 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   315
	end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   316
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   317
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   318
	it 'can generate a message number to thread index' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   319
		idx = list.index
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   320
		expect( idx.size ).to be( 150 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   321
		expect( idx[39][:thread] ).to eq( 'cadgeokhhaieijmndokb' )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   322
	end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   323
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   324
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   325
	it 'fetches thread objects upon request' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   326
		expect( list.thread('cadgeokhhaieijmndokb') ).to be_a( Ezmlm::List::Thread )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   327
	end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   328
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   329
	it 'returns nil when fetching an invalid thread' do
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   330
		expect( list.thread('whatever') ).to be_nil
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   331
	end
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   332
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   333
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   334
	it 'fetches author objects upon request' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   335
		expect( list.author('ojjhjlapnejjlbcplabi') ).to be_a( Ezmlm::List::Author )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   336
	end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   337
16
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   338
	it 'fetches author objects by email address' do
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   339
		author = list.author( 'ojjhjlapnejjlbcplabi' )
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   340
		expect( list.author('yvette@example.net').name ).to eq( author.name )
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   341
	end
e135ccae6783 Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents: 15
diff changeset
   342
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   343
	it 'returns nil when fetching an invalid author' do
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   344
		expect( list.author('whatever') ).to be_nil
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   345
	end
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   346
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   347
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   348
	context 'fetching messages' do
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   349
		it 'returns nil if archiving is disabled' do
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   350
			expect( list ).to receive( :archived? ).and_return( false )
17
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   351
			expect( list.message(1) ).to be_nil
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   352
		end
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   353
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   354
		it 'returns nil when fetching an invalid message id' do
23c7f5c8ee39 Multiple changes.
Mahlon E. Smith <mahlon@laika.com>
parents: 16
diff changeset
   355
			expect( list.message(2389234) ).to be_nil
15
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   356
		end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   357
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   358
		it 'raises an error if the message archive is empty' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   359
			expect( list ).to receive( :message_count ).and_return( 0 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   360
			expect {
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   361
				list.message( 1 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   362
			}.to raise_error( RuntimeError, /message archive is empty/i )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   363
		end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   364
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   365
		it 'returns an archived message' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   366
			message = list.message( 1 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   367
			expect( message.id ).to be( 1 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   368
			expect( message.subject ).to match( /compress program/ )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   369
		end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   370
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   371
		it 'can iterate across all messages' do
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   372
			message = nil
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   373
			list.each_message do |m|
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   374
				if m.id == 20
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   375
					message = m
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   376
					break
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   377
				end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   378
			end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   379
			expect( message ).to_not be_nil
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   380
			expect( message.id ).to be( 20 )
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   381
		end
a38e6916504c Everything is workin!
Mahlon E. Smith <mahlon@laika.com>
parents: 14
diff changeset
   382
	end
14
cba9fb39bcdb Checkpoint commit.
Mahlon E. Smith <mahlon@laika.com>
parents: 12
diff changeset
   383
end
12
3cc813140c80 First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   384