parlement 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/README +9 -3
- data/app/helpers/elt_helper.rb +2 -2
- data/app/helpers/mailman.rb +4 -5
- data/app/models/choice.rb +4 -0
- data/app/models/elt.rb +31 -43
- data/app/models/mail.rb +68 -50
- data/app/models/mail_notify.rb +4 -4
- data/app/models/person.rb +2 -0
- data/app/views/account/_show.rhtml +7 -7
- data/app/views/elt/_elt.rhtml +65 -59
- data/app/views/elt/_list.rhtml +25 -7
- data/app/views/elt/new.rhtml +9 -9
- data/app/views/elt/show.rhtml +18 -6
- data/app/views/layouts/top.rhtml +9 -2
- data/app/views/mail_notify/publish.text.html.rhtml +4 -1
- data/app/views/person/_listElts.rhtml +2 -1
- data/app/views/person/show.rhtml +1 -3
- data/config/environment.rb +1 -1
- data/db/ROOT/parlement/ddRing.txt +1 -1
- data/db/ROOT/parlement/news/release0.4.txt +15 -0
- data/db/ROOT/parlement/news/release0.5.txt +3 -0
- data/db/ROOT/parlement/our-constitution.txt +11 -0
- data/db/ROOT/parlement/top-politics.txt +8 -10
- data/db/development_structure.sql +33 -21
- data/db/migrate/001_create_choices.rb +27 -0
- data/db/schema.sql +4 -3
- data/test/fixtures/choices.yml +13 -0
- data/test/fixtures/mail/mail_ruby +7 -0
- data/test/fixtures/mail/mail_rubyChild +3 -1
- data/test/fixtures/mail/mail_rubyChild2 +30 -0
- data/test/fixtures/subscribers.yml +3 -0
- data/test/unit/choice_test.rb +10 -0
- data/test/unit/mail_notify_test.rb +2 -2
- data/test/unit/mail_test.rb +52 -28
- data/test/unit/subscriber_test.rb +8 -1
- metadata +12 -2
data/test/unit/mail_test.rb
CHANGED
@@ -17,8 +17,7 @@ class MailTest < Test::Unit::TestCase
|
|
17
17
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
18
18
|
#print "mailFile envelope-to: ", mailFile["envelope-to"]
|
19
19
|
#puts
|
20
|
-
|
21
|
-
elt.receive(mailFile)
|
20
|
+
Mail.receive(mailFile)
|
22
21
|
|
23
22
|
assert_equal (mailsCount + 2), Mail.count
|
24
23
|
assert_equal (eltsCount + 2), Elt.count
|
@@ -35,8 +34,7 @@ class MailTest < Test::Unit::TestCase
|
|
35
34
|
eltsCount = Elt.count
|
36
35
|
|
37
36
|
mailFile = TMail::Mail.parse(read_fixture('mail_rubyWithSubject').to_s)
|
38
|
-
|
39
|
-
elt.receive(mailFile)
|
37
|
+
Mail.receive(mailFile)
|
40
38
|
|
41
39
|
assert_equal (mailsCount + 2), Mail.count
|
42
40
|
assert_equal (eltsCount + 2), Elt.count
|
@@ -52,8 +50,7 @@ class MailTest < Test::Unit::TestCase
|
|
52
50
|
eltsCount = Elt.count
|
53
51
|
|
54
52
|
mailFile = TMail::Mail.parse(read_fixture('mail_rubyWithAttachment').to_s)
|
55
|
-
elt =
|
56
|
-
elt.receive(mailFile)
|
53
|
+
elt = Mail.receive(mailFile).elt
|
57
54
|
|
58
55
|
assert_equal (mailsCount + 2), Mail.count
|
59
56
|
# Just one file as an attachment
|
@@ -70,41 +67,37 @@ class MailTest < Test::Unit::TestCase
|
|
70
67
|
def test_receiveChild
|
71
68
|
ActionMailer::Base.deliveries = []
|
72
69
|
|
73
|
-
elt = Elt.new
|
74
70
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
75
|
-
|
71
|
+
Mail.receive(mailFile)
|
76
72
|
|
77
73
|
ActionMailer::Base.deliveries = []
|
78
74
|
mailsCount = Mail.count
|
79
75
|
eltsCount = Elt.count
|
80
76
|
|
81
77
|
mailFileChild = TMail::Mail.parse(read_fixture('mail_rubyChild').to_s)
|
82
|
-
|
83
|
-
elt.receive(mailFileChild)
|
78
|
+
Mail.receive(mailFileChild)
|
84
79
|
|
85
80
|
assert_equal (mailsCount + 1), Mail.count
|
86
81
|
assert_equal (eltsCount + 1), Elt.count
|
87
82
|
|
88
83
|
assert_equal mailFileChild.subject, ActionMailer::Base.deliveries[0].subject
|
89
84
|
assert_equal mailFileChild.references, ActionMailer::Base.deliveries[0].references
|
90
|
-
assert_equal
|
85
|
+
assert_equal mailFileChild.date, ActionMailer::Base.deliveries[0].date
|
91
86
|
end
|
92
87
|
|
93
88
|
# Not used, just make sure mails are entered chronologically
|
94
89
|
def est_receiveChildThenParent
|
95
90
|
ActionMailer::Base.deliveries = []
|
96
91
|
|
97
|
-
elt = Elt.new
|
98
92
|
mailFile = TMail::Mail.parse(read_fixture('mail_rubyChild').to_s)
|
99
|
-
elt.receive(mailFile)
|
93
|
+
elt = Mail.receive(mailFile).elt
|
100
94
|
|
101
95
|
ActionMailer::Base.deliveries = []
|
102
96
|
mailsCount = Mail.count
|
103
97
|
eltsCount = Elt.count
|
104
98
|
|
105
99
|
mailFileChild = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
106
|
-
eltParent =
|
107
|
-
eltParent.receive(mailFileChild)
|
100
|
+
eltParent = Mail.receive(mailFileChild).elt
|
108
101
|
|
109
102
|
assert_equal (mailsCount + 1), Mail.count
|
110
103
|
assert_equal (eltsCount + 1), Elt.count
|
@@ -116,8 +109,7 @@ class MailTest < Test::Unit::TestCase
|
|
116
109
|
ActionMailer::Base.deliveries = []
|
117
110
|
|
118
111
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
119
|
-
|
120
|
-
elt.receive(mailFile)
|
112
|
+
Mail.receive(mailFile)
|
121
113
|
|
122
114
|
mailsCount = Mail.count
|
123
115
|
eltsCount = Elt.count
|
@@ -125,8 +117,7 @@ class MailTest < Test::Unit::TestCase
|
|
125
117
|
|
126
118
|
mail = ActionMailer::Base.deliveries[1]
|
127
119
|
|
128
|
-
|
129
|
-
elt.receive(mail)
|
120
|
+
Mail.receive(mail)
|
130
121
|
|
131
122
|
assert_equal mailsCount, Mail.count
|
132
123
|
assert_equal eltsCount, Elt.count
|
@@ -137,8 +128,7 @@ class MailTest < Test::Unit::TestCase
|
|
137
128
|
ActionMailer::Base.deliveries = []
|
138
129
|
|
139
130
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
140
|
-
|
141
|
-
elt.receive(mailFile)
|
131
|
+
Mail.receive(mailFile)
|
142
132
|
|
143
133
|
mailsCount = Mail.count
|
144
134
|
eltsCount = Elt.count
|
@@ -154,8 +144,7 @@ class MailTest < Test::Unit::TestCase
|
|
154
144
|
#print "new mail.message_Id: ", mail.message_id
|
155
145
|
#puts
|
156
146
|
|
157
|
-
|
158
|
-
elt.receive(mail)
|
147
|
+
Mail.receive(mail)
|
159
148
|
|
160
149
|
assert_equal mailsCount, Mail.count
|
161
150
|
assert_equal eltsCount, Elt.count
|
@@ -171,8 +160,7 @@ class MailTest < Test::Unit::TestCase
|
|
171
160
|
|
172
161
|
|
173
162
|
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
174
|
-
elt =
|
175
|
-
elt.receive(mailFile)
|
163
|
+
elt = Mail.receive(mailFile).elt
|
176
164
|
|
177
165
|
#print mailFile.to_yaml
|
178
166
|
#puts
|
@@ -180,11 +168,47 @@ class MailTest < Test::Unit::TestCase
|
|
180
168
|
|
181
169
|
#puts elt.body
|
182
170
|
|
183
|
-
#puts elt.body =~ /même/
|
184
171
|
assert elt.body =~ /même/
|
172
|
+
end
|
185
173
|
|
186
|
-
|
187
|
-
|
174
|
+
def test_receive_no_choice
|
175
|
+
ActionMailer::Base.deliveries = []
|
176
|
+
|
177
|
+
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
178
|
+
elt = Mail.receive(mailFile).elt
|
179
|
+
choicesCount = 0
|
180
|
+
|
181
|
+
elt.voters.reload
|
182
|
+
assert_equal choicesCount+1, elt.voters.size
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_receive_choice
|
186
|
+
ActionMailer::Base.deliveries = []
|
187
|
+
|
188
|
+
mailFile = TMail::Mail.parse(read_fixture('mail_ruby').to_s)
|
189
|
+
elt = Mail.receive(mailFile).elt
|
190
|
+
|
191
|
+
eltChild = Mail.receive(TMail::Mail.parse(read_fixture('mail_rubyChild').to_s)).elt
|
192
|
+
|
193
|
+
eltChild.voters.reload
|
194
|
+
assert_equal 1, eltChild.voters.size
|
195
|
+
|
196
|
+
assert_equal 1, eltChild.result
|
197
|
+
assert_equal -1, elt.result
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_receive_second_choice
|
201
|
+
elt = Mail.receive(TMail::Mail.parse(read_fixture('mail_ruby').to_s)).elt
|
202
|
+
|
203
|
+
eltChild = Mail.receive(TMail::Mail.parse(read_fixture('mail_rubyChild').to_s)).elt
|
204
|
+
|
205
|
+
eltChild2 = Mail.receive(TMail::Mail.parse(read_fixture('mail_rubyChild2').to_s)).elt
|
206
|
+
|
207
|
+
elt.choices.reload
|
208
|
+
elt.voters.reload
|
209
|
+
assert 1, elt.choices.size
|
210
|
+
assert_equal 1, eltChild2.result
|
211
|
+
assert_equal 1, elt.result
|
188
212
|
end
|
189
213
|
end
|
190
214
|
|
@@ -4,7 +4,7 @@ class SubscriberTest < Test::Unit::TestCase
|
|
4
4
|
fixtures :people, :users, :elts, :mails, :attachments, :subscribers
|
5
5
|
|
6
6
|
def setup
|
7
|
-
@elt = Elt.find('
|
7
|
+
@elt = Elt.find('mail')
|
8
8
|
@person = Person.find('first')
|
9
9
|
end
|
10
10
|
|
@@ -31,5 +31,12 @@ class SubscriberTest < Test::Unit::TestCase
|
|
31
31
|
@person.subscribed_elts.delete(@elt)
|
32
32
|
assert_equal (num - 1), @person.subscribed_elts.size
|
33
33
|
end
|
34
|
+
|
35
|
+
def test_all_recipients
|
36
|
+
num = @elt.all_recipients.size
|
37
|
+
@elt.subscribers << Person.find('bob')
|
38
|
+
@elt.parent.subscribers << Person.find('bob2')
|
39
|
+
assert_equal (num + 2), @elt.all_recipients.size
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: parlement
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2006-
|
6
|
+
version: "0.5"
|
7
|
+
date: 2006-05-20 00:00:00 +02:00
|
8
8
|
summary: Trusted Direct Democracy on a forum
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- app/models/person.rb
|
55
55
|
- app/models/mail.rb
|
56
56
|
- app/models/elt.rb
|
57
|
+
- app/models/choice.rb
|
57
58
|
- app/models/mail_notify.rb
|
58
59
|
- app/models/user_notify.rb
|
59
60
|
- app/views/layouts
|
@@ -94,8 +95,10 @@ files:
|
|
94
95
|
- config/environments/user_environment.rb
|
95
96
|
- db/schema.sql
|
96
97
|
- db/schema.rb
|
98
|
+
- db/migrate
|
97
99
|
- db/ROOT
|
98
100
|
- db/development_structure.sql
|
101
|
+
- db/migrate/001_create_choices.rb
|
99
102
|
- db/ROOT/perso
|
100
103
|
- db/ROOT/parlement.txt
|
101
104
|
- db/ROOT/perso.txt
|
@@ -109,10 +112,13 @@ files:
|
|
109
112
|
- db/ROOT/parlement/news.txt
|
110
113
|
- db/ROOT/parlement/top-politics.txt
|
111
114
|
- db/ROOT/parlement/ddRing.txt
|
115
|
+
- db/ROOT/parlement/our-constitution.txt
|
112
116
|
- db/ROOT/parlement/security/anonymity.txt
|
113
117
|
- db/ROOT/parlement/news/release0.1.txt
|
114
118
|
- db/ROOT/parlement/news/release0.2.txt
|
115
119
|
- db/ROOT/parlement/news/release0.3.txt
|
120
|
+
- db/ROOT/parlement/news/release0.4.txt
|
121
|
+
- db/ROOT/parlement/news/release0.5.txt
|
116
122
|
- lib/localization.rb
|
117
123
|
- lib/tasks
|
118
124
|
- lib/data_import.rb
|
@@ -171,10 +177,12 @@ files:
|
|
171
177
|
- test/fixtures/mail
|
172
178
|
- test/fixtures/subscribers.yml
|
173
179
|
- test/fixtures/mail_notify
|
180
|
+
- test/fixtures/choices.yml
|
174
181
|
- test/fixtures/mail/mail_ruby
|
175
182
|
- test/fixtures/mail/mail_rubyWithSubject
|
176
183
|
- test/fixtures/mail/mail_rubyWithAttachment
|
177
184
|
- test/fixtures/mail/mail_rubyChild
|
185
|
+
- test/fixtures/mail/mail_rubyChild2
|
178
186
|
- test/functional/subscriber_controller_test.rb
|
179
187
|
- test/functional/account_controller_test.rb
|
180
188
|
- test/functional/person_controller_test.rb
|
@@ -190,6 +198,7 @@ files:
|
|
190
198
|
- test/unit/attachment_test.rb
|
191
199
|
- test/unit/mail_notify_test.rb
|
192
200
|
- test/unit/subscriber_test.rb
|
201
|
+
- test/unit/choice_test.rb
|
193
202
|
- vendor/plugins
|
194
203
|
- vendor/plugins/login_engine
|
195
204
|
- vendor/plugins/engines
|
@@ -335,6 +344,7 @@ test_files:
|
|
335
344
|
- test/unit/attachment_test.rb
|
336
345
|
- test/unit/mail_notify_test.rb
|
337
346
|
- test/unit/subscriber_test.rb
|
347
|
+
- test/unit/choice_test.rb
|
338
348
|
rdoc_options: []
|
339
349
|
|
340
350
|
extra_rdoc_files: []
|