adherent 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/adherent/jcmenu.css +5 -0
- data/app/controllers/adherent/allpayments_controller.rb +1 -1
- data/app/controllers/adherent/application_controller.rb +12 -0
- data/app/controllers/adherent/members_controller.rb +6 -7
- data/app/controllers/adherent/payments_controller.rb +2 -2
- data/app/helpers/adherent/application_helper.rb +9 -5
- data/app/helpers/adherent/payments_helper.rb +2 -2
- data/app/models/adherent/member.rb +77 -9
- data/app/models/adherent/payment.rb +0 -10
- data/app/views/adherent/allpayments/_payment.html.haml +3 -2
- data/app/views/adherent/members/index.html.erb +7 -1
- data/app/views/adherent/payments/_payment.html.haml +3 -2
- data/app/views/adherent/payments/show.html.haml +2 -2
- data/lib/adherent/version.rb +2 -1
- data/spec/controllers/adherent/adhesions_controller_spec.rb +25 -57
- data/spec/controllers/adherent/allpayments_controller_spec.rb +4 -1
- data/spec/controllers/adherent/members_controller_spec.rb +33 -46
- data/spec/controllers/adherent/payments_controller_spec.rb +18 -31
- data/spec/dummy/log/development.log +21002 -0
- data/spec/dummy/log/test.log +135111 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8259f3fc885403b4eea8dd12964c2ffc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c35251b000451b1b9f7274e0ae471704 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d88c0d3362ebdb47849b797a3ec1b355 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ee6531726dfe6592fa84b42a420b6acd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fca89522784c8592001dc314a2361344 +0 -0
- data/spec/features/adhesions_spec.rb +3 -9
- data/spec/features/coord_spec.rb +3 -5
- data/spec/features/js_spec.rb +17 -15
- data/spec/features/members_spec.rb +26 -46
- data/spec/features/payments_spec.rb +15 -39
- data/spec/features/reglements_spec.rb +25 -31
- data/spec/models/adherent/adhesion_spec.rb +18 -40
- data/spec/models/adherent/coord_spec.rb +12 -9
- data/spec/models/adherent/member_spec.rb +144 -92
- data/spec/models/adherent/payment_spec.rb +20 -99
- data/spec/models/adherent/reglement_spec.rb +1 -1
- data/spec/rails_helper.rb +2 -1
- data/spec/spec_helper.rb +1 -0
- metadata +1 -6
- data/app/models/adherent/query_member.rb +0 -125
- data/spec/models/adherent/query_member_spec.rb +0 -169
- data/spec/support/fixtures.rb +0 -29
@@ -3,186 +3,238 @@
|
|
3
3
|
require 'rails_helper'
|
4
4
|
|
5
5
|
RSpec.configure do |c|
|
6
|
-
|
7
|
-
|
6
|
+
# c.exclusion_filter = {js:true}
|
7
|
+
# c.filter = {wip:true}
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
10
|
describe Adherent::Member, :type => :model do
|
11
|
+
fixtures :all
|
12
12
|
|
13
13
|
def valid_attributes
|
14
|
-
{name:'Dupont', forname:'Jules', number:'Adh 001'}
|
14
|
+
{name:'Dupont', forname:'Jules', number:'Adh 001', organism_id:1}
|
15
15
|
end
|
16
16
|
|
17
17
|
describe 'validation' do
|
18
18
|
it 'valid_attributes est valide' do
|
19
19
|
m = Adherent::Member.new(valid_attributes)
|
20
|
-
m.organism_id = 1
|
21
20
|
expect(m).to be_valid
|
22
21
|
end
|
23
22
|
|
24
23
|
it 'invalide sans nom' do
|
25
|
-
|
26
|
-
|
27
|
-
m = Adherent::Member.new(va)
|
28
|
-
m.organism_id = 1
|
24
|
+
m = adherent_members(:Dupont)
|
25
|
+
m.name = nil
|
29
26
|
expect(m).not_to be_valid
|
30
27
|
end
|
31
28
|
|
32
29
|
it 'invalide sans prenom' do
|
33
|
-
|
34
|
-
|
35
|
-
m = Adherent::Member.new(va)
|
36
|
-
m.organism_id = 1
|
30
|
+
m = adherent_members(:Dupont)
|
31
|
+
m.forname = nil
|
37
32
|
expect(m).not_to be_valid
|
38
33
|
end
|
39
34
|
|
40
35
|
it 'invalide sans numéro' do
|
41
|
-
|
42
|
-
|
43
|
-
m
|
44
|
-
|
36
|
+
m = adherent_members(:Dupont)
|
37
|
+
m.number = nil
|
38
|
+
expect(m).not_to be_valid
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'invalide si numero existe déja pour cet organisme' do
|
42
|
+
m = Adherent::Member.new(name:'Dupont', forname:'Alain', organism_id:1,
|
43
|
+
number:adherent_members(:Dupont).number)
|
45
44
|
expect(m).not_to be_valid
|
46
45
|
end
|
47
46
|
|
47
|
+
it 'mais valide pour un autre organisme' do
|
48
|
+
m = Adherent::Member.new(name:'Dupont', forname:'Alain', organism_id:2,
|
49
|
+
number:adherent_members(:Dupont).number)
|
50
|
+
expect(m).to be_valid
|
51
|
+
end
|
52
|
+
|
48
53
|
describe 'test de birthdate' do
|
49
|
-
before(:each) do
|
50
|
-
@m = Adherent::Member.new(valid_attributes)
|
51
|
-
@m.organism_id = 1
|
52
|
-
end
|
53
|
-
|
54
54
|
it 'on peut rentrer une date de naissance' do
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
m = adherent_members(:Durand)
|
56
|
+
m.birthdate = '06/06/1944'
|
57
|
+
m.save
|
58
|
+
expect(m.read_attribute(:birthdate)).to eq(Date.civil(1944,6,6))
|
58
59
|
end
|
59
60
|
|
60
|
-
|
61
61
|
end
|
62
|
-
|
63
|
-
describe 'le numéro est unique' do
|
64
|
-
before(:each) do
|
65
|
-
@m = Adherent::Member.new(valid_attributes)
|
66
|
-
@m.organism_id = 1
|
67
|
-
@m.save!
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'on ne peut créer un autre adhérent avec la même référence' do
|
71
|
-
m = Adherent::Member.new(name:'Buck', forname:'Charles', number:'Adh 001')
|
72
|
-
m.organism_id = 1
|
73
|
-
expect(m).not_to be_valid
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'mais on peut si organisme différent' do
|
77
|
-
m = Adherent::Member.new(name:'Buck', forname:'Charles', number:'Adh 001')
|
78
|
-
m.organism_id = 2
|
79
|
-
expect(m).to be_valid
|
80
|
-
end
|
81
|
-
|
82
62
|
|
83
|
-
end
|
84
|
-
|
85
63
|
end
|
86
64
|
|
87
65
|
describe 'méthodes' do
|
88
|
-
|
89
|
-
before(:each) do
|
90
|
-
@m = Adherent::Member.new(valid_attributes)
|
91
|
-
@m.organism_id = 1
|
92
|
-
end
|
93
|
-
|
66
|
+
|
94
67
|
it 'to s renvoie le nom et le prénom' do
|
95
|
-
expect(
|
68
|
+
expect(adherent_members(:Dupont).to_s).to eq('Jules DUPONT')
|
96
69
|
end
|
97
70
|
|
98
71
|
describe 'next_adhesion' do
|
72
|
+
context 'un membre qui n en a pas encore' do
|
73
|
+
|
74
|
+
subject {adherent_members(:Durand)}
|
99
75
|
|
100
|
-
|
101
|
-
|
102
|
-
|
76
|
+
it 'next_adhesion renvoie une adhésion relevant de ce membre' do
|
77
|
+
expect(subject.next_adhesion).to be_an_instance_of(Adherent::Adhesion)
|
78
|
+
end
|
103
79
|
|
104
|
-
|
105
|
-
|
106
|
-
|
80
|
+
it 'avec 0 comme montant' do
|
81
|
+
expect(subject.next_adhesion.amount).to eq(0)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'mais on peut fournir un montant' do
|
85
|
+
@na = subject.next_adhesion(25)
|
86
|
+
expect(@na.amount).to eq(25)
|
87
|
+
end
|
107
88
|
|
108
|
-
it 'mais on peut fournir un montant' do
|
109
|
-
@na = @m.next_adhesion(25)
|
110
|
-
expect(@na.amount).to eq(25)
|
111
89
|
end
|
112
90
|
|
113
|
-
context 'avec déjà une adhésion' do
|
91
|
+
context 'un membre avec déjà une adhésion' do
|
114
92
|
|
115
|
-
|
116
|
-
@m.save!
|
117
|
-
@m.next_adhesion(26.66).save!
|
118
|
-
|
119
|
-
end
|
93
|
+
subject {adherent_members(:Dupont)}
|
120
94
|
|
121
95
|
it 'next_adhesion renvoie une adhésion' do
|
122
|
-
expect(
|
96
|
+
expect(subject.next_adhesion).to be_an_instance_of(Adherent::Adhesion)
|
123
97
|
end
|
124
98
|
|
125
99
|
it 'dont le montant est identique au précédent'do
|
126
|
-
expect(
|
100
|
+
expect(subject.next_adhesion.amount).to eq(26.66)
|
127
101
|
end
|
128
102
|
|
129
103
|
it 'mais on peut surcharger' do
|
130
|
-
expect(
|
104
|
+
expect(subject.next_adhesion(44).amount).to eq(44)
|
131
105
|
end
|
132
106
|
|
133
|
-
|
134
107
|
end
|
135
108
|
|
136
109
|
end
|
137
110
|
|
138
111
|
describe 'les adhésions impayées' do
|
139
112
|
|
140
|
-
|
141
|
-
allow(@m).to receive(:adhesions).and_return @ar=double(Arel)
|
142
|
-
allow(@ar).to receive(:order).with(:to_date).and_return(@ar)
|
143
|
-
allow(@ar).to receive(:unpaid).and_return([double(:due=>12), double(:due=>27)])
|
144
|
-
end
|
113
|
+
subject {adherent_members(:Dupont)}
|
145
114
|
|
146
115
|
it 'le membre a des adhésions non payées' do
|
147
|
-
expect(
|
116
|
+
expect(subject).to be_unpaid_adhesions
|
148
117
|
end
|
149
|
-
|
150
118
|
|
151
119
|
it 'pour un montant total de 39' do
|
152
|
-
expect(
|
120
|
+
expect(subject.unpaid_amount).to eq(26.66)
|
153
121
|
end
|
154
122
|
|
155
|
-
|
156
|
-
|
157
123
|
end
|
158
124
|
|
159
125
|
describe 'jusquau' do
|
160
126
|
|
161
127
|
context 'sans adhésion' do
|
162
128
|
|
129
|
+
subject {adherent_members(:Durand)}
|
130
|
+
|
163
131
|
it 'renvoie inconnu' do
|
164
|
-
|
165
|
-
allow(@m).to receive(:created_at).and_return Time.now
|
166
|
-
expect(@m.jusquau).to eq(I18n::l(Date.today))
|
132
|
+
expect(subject.jusquau).to eq(I18n::l subject.created_at.to_date)
|
167
133
|
end
|
168
134
|
|
169
135
|
end
|
170
136
|
|
171
137
|
context 'avec adhésion' do
|
138
|
+
subject {adherent_members(:Dupont)}
|
139
|
+
|
172
140
|
it 'renvoie la date de fin cette adhésion' do
|
173
|
-
|
174
|
-
and_return double(Adherent::Adhesion, to_date:Date.today)
|
175
|
-
expect(@m.jusquau).to eq(Date.today)
|
141
|
+
expect(subject.jusquau).to eq I18n::l(Date.today.years_since(1) -1)
|
176
142
|
end
|
177
143
|
|
178
144
|
end
|
179
145
|
|
146
|
+
end
|
147
|
+
|
148
|
+
describe 'query_members' do
|
149
|
+
subject {adherent_members(:Fidele)}
|
150
|
+
|
151
|
+
before(:each) do
|
152
|
+
subject.build_coord(tel:'01.02.03.04.05', mail:'bonjour@example.com')
|
153
|
+
subject.save!
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'query_member' do
|
157
|
+
expect(Adherent::Member.query_members(organisms(:asso)).size).to eq(3)
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'peut créer un csv' do
|
161
|
+
expect {Adherent::Member.to_csv(organisms(:asso))}.to_not raise_error
|
162
|
+
end
|
180
163
|
|
164
|
+
it 'qui possède une ligne de titre' do
|
165
|
+
csv = Adherent::Member.to_csv(organisms(:asso))
|
166
|
+
expect(csv.split("\n").first).
|
167
|
+
to eq "Numero\tNom\tPrénom\tDate de naissance\tMail\tTél\tGsm\tBureau\tAdresse\tCode Postal\tVille\tDoit\tFin Adh."
|
168
|
+
end
|
181
169
|
|
170
|
+
it 'qui possède une ligne des lignes adhérents' do
|
171
|
+
csv = Adherent::Member.to_csv(organisms(:asso))
|
172
|
+
fidele = csv.split("\n").select {|l| 'Fidele'.in? l}.first
|
173
|
+
expect(fidele).
|
174
|
+
to eq "A003\tFidele\tChe\t\tbonjour@example.com\t01.02.03.04.05\t\t\t\t\t\t50,00\t#{(Date.today.years_since(2) -1)}"
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'avec deux adhésions' do
|
178
|
+
|
179
|
+
subject {adherent_members(:Fidele)}
|
180
|
+
|
181
|
+
it 'donne la bonne fin d adhésion' do
|
182
|
+
expect(subject.jusquau).to eq I18n::l((Date.today.years_since(2)) -1)
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'avec des règlements' do
|
186
|
+
# Fidele est un membre avec deux adhésions de 25 € chacune
|
187
|
+
|
188
|
+
before(:each) do
|
189
|
+
@p = subject.payments.new(date:Date.today, amount:8, mode:'CB')
|
190
|
+
allow(@p).to receive(:correct_range_date).and_return true
|
191
|
+
@p.save
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'le membre doit encore 14.26 ' do
|
195
|
+
ms = Adherent::Member.query_members(organisms(:asso))
|
196
|
+
m = ms.select {|a| a.number == subject.number}.first
|
197
|
+
expect(m.t_reglements).to eq(8)
|
198
|
+
expect(m.t_adhesions).to eq(50)
|
199
|
+
expect(m.montant_du).to eq(42)
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'après un paiement de 10.50 €, il doit encore 31,50' do
|
203
|
+
@p = subject.payments.new(date:Date.today, amount:10.50, mode:'CB')
|
204
|
+
allow(@p).to receive(:correct_range_date).and_return true
|
205
|
+
@p.save
|
206
|
+
ms = Adherent::Member.query_members(organisms(:asso))
|
207
|
+
m = ms.select {|a| a.number == subject.number}.first
|
208
|
+
expect(m.montant_du).to eq(31.50)
|
209
|
+
expect(m.a_jour?).to be false
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'avec de paiements, l un de 20,50, l autre de 21,50 € il ne doit plus rien' do
|
213
|
+
@p = subject.payments.new(date:Date.today, amount:20.50, mode:'CB')
|
214
|
+
@q = subject.payments.new(date:Date.today, amount:21.50, mode:'CB')
|
215
|
+
allow(@p).to receive(:correct_range_date).and_return true
|
216
|
+
allow(@q).to receive(:correct_range_date).and_return true
|
217
|
+
@p.save; @q.save
|
218
|
+
ms = Adherent::Member.query_members(organisms(:asso))
|
219
|
+
m = ms.select {|a| a.number == subject.number}.first
|
220
|
+
expect(m.montant_du).to eq(0)
|
221
|
+
expect(m.a_jour?).to be true
|
222
|
+
end
|
223
|
+
|
224
|
+
it 's il paye plus il ne doit rien non plus' do
|
225
|
+
@p = subject.payments.new(date:Date.today, amount:60, mode:'CB')
|
226
|
+
allow(@p).to receive(:correct_range_date).and_return true
|
227
|
+
@p.save
|
228
|
+
ms = Adherent::Member.query_members(organisms(:asso))
|
229
|
+
m = ms.select {|a| a.number == subject.number}.first
|
230
|
+
expect(m.montant_du).to eq(0)
|
231
|
+
expect(m.a_jour?).to be true
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
end
|
182
236
|
end
|
183
|
-
|
184
237
|
end
|
185
|
-
|
186
238
|
end
|
187
239
|
|
188
240
|
|
@@ -1,27 +1,19 @@
|
|
1
1
|
# coding utf-8
|
2
2
|
|
3
3
|
require 'rails_helper'
|
4
|
-
|
4
|
+
|
5
5
|
|
6
6
|
RSpec.configure do |c|
|
7
7
|
# c.filter = {:wip=>true}
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'Payment', :type => :model do
|
11
|
-
|
11
|
+
fixtures :all
|
12
12
|
|
13
|
-
def new_payment
|
14
|
-
@pay = Adherent::Payment.new(amount:111, mode:'CB', date:Date.today)
|
15
|
-
@pay.member_id = 1
|
16
|
-
allow(@pay).to receive(:member).and_return(@ar = double(Arel))
|
17
|
-
allow(@ar).to receive(:organism).and_return(Organism.new)
|
18
|
-
@pay
|
19
|
-
end
|
20
|
-
|
21
13
|
describe 'validations' do
|
22
14
|
|
23
15
|
before(:each) do
|
24
|
-
|
16
|
+
@pay = adherent_payments(:pay_1)
|
25
17
|
end
|
26
18
|
|
27
19
|
it 'new_payment est valide' , wip:true do
|
@@ -57,137 +49,66 @@ describe 'Payment', :type => :model do
|
|
57
49
|
describe 'imputation after create' do
|
58
50
|
|
59
51
|
before(:each) do
|
60
|
-
|
61
|
-
@member = @members.first
|
62
|
-
@member.adhesions.create(:from_date=>Date.today, :to_date=>Date.today.months_since(1), amount:27 )
|
63
|
-
@member.next_adhesion.save
|
64
|
-
allow(@member).to receive(:organism).and_return(Organism.new)
|
52
|
+
@member = adherent_members(:Fidele)
|
65
53
|
end
|
66
54
|
|
67
|
-
it 'enregistrer un payement crée
|
68
|
-
@member.payments.create(:amount=>54, date:Date.today, mode:'CB')
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'ne crée qu un règlement si le montant est insuffisant' do
|
73
|
-
@member.payments.create(:amount=>25, date:Date.today, mode:'CB')
|
74
|
-
expect(Adherent::Reglement.count).to eq(1)
|
55
|
+
it 'enregistrer un payement crée 1 règlement' do
|
56
|
+
expect{@member.payments.create(:amount=>54, date:Date.today, mode:'CB')}.
|
57
|
+
to change {Adherent::Reglement.count}.by 2 # car Fidele a 2 adhesions
|
75
58
|
end
|
76
59
|
|
77
60
|
it 'sait calculer le montant restant à imputer si plus que suffisant' do
|
78
|
-
pay = @member.payments.create(:amount=>
|
79
|
-
expect(pay.non_impute).to eq(
|
61
|
+
pay = @member.payments.create(:amount=>54, date:Date.today, mode:'CB')
|
62
|
+
expect(pay.non_impute).to eq(4)
|
80
63
|
end
|
81
64
|
|
82
65
|
it 'un paiement hors date ajoute une erreur' do
|
83
|
-
p = @member.payments.
|
84
|
-
p.save
|
66
|
+
p = @member.payments.create(:amount=>25, date:Date.today << 5, mode:'CB')
|
85
67
|
expect(p.errors.messages[:date]).to eq(['hors limite'])
|
86
68
|
end
|
87
69
|
|
88
70
|
it 'et n\'est pas sauvé' do
|
89
71
|
p = @member.payments.new(:amount=>25, date:Date.today << 5, mode:'CB')
|
90
72
|
expect {p.save}.not_to change {Adherent::Payment.count}
|
91
|
-
|
92
73
|
end
|
93
74
|
|
94
|
-
|
95
75
|
end
|
96
76
|
|
97
77
|
|
98
|
-
describe 'Imputation on adh'
|
78
|
+
describe 'Imputation on adh' do
|
99
79
|
|
100
80
|
# soit un paiement et une adhésion, lorsqu'on impute le paiement
|
101
81
|
# sur cette adhésion, il est créé un réglement pour le montant adapté,
|
102
82
|
# soit la totalité de l'adhésion si le non imputé est supérieur
|
103
83
|
# soit le montant non imputé si le non imputé est inférieur
|
104
84
|
before(:each) do
|
105
|
-
@
|
106
|
-
@
|
85
|
+
@p = adherent_payments(:pay_1) # un paiement de 15 €
|
86
|
+
@m = @p.member # le membre Dupont
|
87
|
+
@a = @m.adhesions.first # avec une adhésion de 26.66
|
107
88
|
end
|
108
89
|
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'avec un adhésion de 50' do
|
114
|
-
@a = Adherent::Adhesion.create!(member_id:@m.id, amount:50,
|
115
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
90
|
+
it 'avec un paiement du montant de l adhésion' do
|
91
|
+
@p.amount = 26.66; @p.save
|
116
92
|
@p.imputation_on_adh(@a.id)
|
117
93
|
expect(@p.non_impute).to eq 0
|
118
94
|
expect(@a).to be_is_paid
|
119
95
|
end
|
120
96
|
|
121
|
-
it 'avec un
|
122
|
-
@a = Adherent::Adhesion.create!(member_id:@m.id, amount:60,
|
123
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
97
|
+
it 'avec un paiement inférieur à l adhésion' do
|
124
98
|
@p.imputation_on_adh(@a.id)
|
125
99
|
expect(@p.non_impute).to eq 0
|
126
100
|
expect(@a).not_to be_is_paid
|
127
|
-
expect(@a.due).to eq
|
101
|
+
expect(@a.due).to eq 11.66
|
128
102
|
end
|
129
103
|
|
130
|
-
it 'avec un
|
131
|
-
@
|
132
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
104
|
+
it 'avec un paiement supérieur à l adhésion' do
|
105
|
+
@p.amount = 36.66; @p.save
|
133
106
|
@p.imputation_on_adh(@a.id)
|
134
107
|
expect(@p.non_impute).to eq 10
|
135
108
|
expect(@a).to be_is_paid
|
136
109
|
expect(@a.due).to eq 0
|
137
110
|
end
|
138
111
|
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
|
-
describe 'list_imputations', wip:true do
|
143
|
-
|
144
|
-
# la liste des imputations donne un Array d'information sur les
|
145
|
-
# règlements associés à un paiement, array construit avec la méthode
|
146
|
-
# member.to_s.
|
147
|
-
# La méthode ne doit pas créer d'erreur même si l'adhésion ou le membre
|
148
|
-
# n'existe plus
|
149
|
-
before(:each) do
|
150
|
-
@m = create_members(1).first # on créé un member
|
151
|
-
@p = create_payment(@m) # un payement de 50€ par défaut
|
152
|
-
end
|
153
|
-
|
154
|
-
after(:each) do
|
155
|
-
Adherent::Adhesion.delete_all
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'avec une seule imputation' do
|
159
|
-
@a = Adherent::Adhesion.create!(member_id:@m.id, amount:50,
|
160
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
161
|
-
@p.imputation_on_adh(@a.id)
|
162
|
-
@p.reglements(true)
|
163
|
-
expect(@p.list_imputations).to eq [member:@m.to_s, amount:50, r_id:@p.reglements.first.id]
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'avec deux imputations' do
|
167
|
-
@a = Adherent::Adhesion.create!(member_id:@m.id, amount:10,
|
168
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
169
|
-
@p.imputation_on_adh(@a.id)
|
170
|
-
@a2 = Adherent::Adhesion.create!(member_id:@m.id, amount:10,
|
171
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
172
|
-
@p.imputation_on_adh(@a2.id)
|
173
|
-
@p.reglements(true)
|
174
|
-
expect(@p.list_imputations).
|
175
|
-
to eq([{member:@m.to_s, amount:10, r_id:@p.reglements.first.id},
|
176
|
-
{member:@m.to_s, amount:10, r_id:@p.reglements.last.id}])
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'avec un adhérent effacé, affiche Adhésion inconnue' do
|
180
|
-
@a = Adherent::Adhesion.create!(member_id:@m.id, amount:50,
|
181
|
-
from_date:Date.today, to_date:(Date.today.years_since(1)))
|
182
|
-
@p.imputation_on_adh(@a.id)
|
183
|
-
@p.reglements(true)
|
184
|
-
@a.delete
|
185
|
-
expect(@p.list_imputations).
|
186
|
-
to eq [{member:'Inconnue', amount:50, r_id:@p.reglements.first.id}]
|
187
|
-
end
|
188
|
-
|
189
|
-
|
190
|
-
|
191
112
|
end
|
192
113
|
|
193
114
|
end
|
data/spec/rails_helper.rb
CHANGED
@@ -18,7 +18,8 @@ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
18
18
|
|
19
19
|
RSpec.configure do |config|
|
20
20
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
-
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
22
23
|
|
23
24
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
25
|
# examples within a transaction, remove the following line or assign false
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adherent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Claude Lepage
|
@@ -479,7 +479,6 @@ files:
|
|
479
479
|
- app/models/adherent/coord.rb
|
480
480
|
- app/models/adherent/member.rb
|
481
481
|
- app/models/adherent/payment.rb
|
482
|
-
- app/models/adherent/query_member.rb
|
483
482
|
- app/models/adherent/reglement.rb
|
484
483
|
- app/models/organism.rb
|
485
484
|
- app/views/adherent/adhesions/_form.html.haml
|
@@ -1068,11 +1067,9 @@ files:
|
|
1068
1067
|
- spec/models/adherent/coord_spec.rb
|
1069
1068
|
- spec/models/adherent/member_spec.rb
|
1070
1069
|
- spec/models/adherent/payment_spec.rb
|
1071
|
-
- spec/models/adherent/query_member_spec.rb
|
1072
1070
|
- spec/models/adherent/reglement_spec.rb
|
1073
1071
|
- spec/rails_helper.rb
|
1074
1072
|
- spec/spec_helper.rb
|
1075
|
-
- spec/support/fixtures.rb
|
1076
1073
|
- spec/views/adherent/allpayments/index.html.erb_spec.rb
|
1077
1074
|
- spec/views/adherent/payments/new.html.haml_spec.rb
|
1078
1075
|
homepage: http://faiteslescomptes.fr
|
@@ -1100,7 +1097,6 @@ signing_key:
|
|
1100
1097
|
specification_version: 4
|
1101
1098
|
summary: Gestion des adhérents d'une association
|
1102
1099
|
test_files:
|
1103
|
-
- spec/models/adherent/query_member_spec.rb
|
1104
1100
|
- spec/models/adherent/adhesion_spec.rb
|
1105
1101
|
- spec/models/adherent/reglement_spec.rb
|
1106
1102
|
- spec/models/adherent/member_spec.rb
|
@@ -1627,7 +1623,6 @@ test_files:
|
|
1627
1623
|
- spec/controllers/adherent/reglements_controller_spec.rb
|
1628
1624
|
- spec/controllers/adherent/payments_controller_spec.rb
|
1629
1625
|
- spec/controllers/adherent/adhesions_controller_spec.rb
|
1630
|
-
- spec/support/fixtures.rb
|
1631
1626
|
- spec/helpers/adherent/allpayments_helper_spec.rb
|
1632
1627
|
- spec/features/reglements_spec.rb
|
1633
1628
|
- spec/features/js_spec.rb
|