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
@@ -2,12 +2,18 @@
|
|
2
2
|
|
3
3
|
require 'rails_helper'
|
4
4
|
|
5
|
+
RSpec.configure do |c|
|
6
|
+
# c.exclusion_filter = {js:true}
|
7
|
+
# c.filter = {wip:true}
|
8
|
+
end
|
9
|
+
|
5
10
|
describe Adherent::MembersController, :type => :controller do
|
6
11
|
|
12
|
+
fixtures ['organisms', 'adherent/members']
|
13
|
+
|
7
14
|
before(:each) do
|
8
|
-
|
15
|
+
@routes = Adherent::Engine.routes
|
9
16
|
end
|
10
|
-
|
11
17
|
|
12
18
|
describe "GET index" do
|
13
19
|
|
@@ -18,7 +24,7 @@ describe Adherent::MembersController, :type => :controller do
|
|
18
24
|
|
19
25
|
|
20
26
|
it "assigns all members as @members" do
|
21
|
-
expect(Adherent::
|
27
|
+
expect(Adherent::Member).to receive(:query_members).and_return([1,2])
|
22
28
|
get :index
|
23
29
|
expect(assigns(:members)).to eq([1,2])
|
24
30
|
end
|
@@ -33,15 +39,10 @@ describe Adherent::MembersController, :type => :controller do
|
|
33
39
|
end
|
34
40
|
|
35
41
|
describe "GET show" do
|
36
|
-
|
37
|
-
expect(Adherent::Member).to receive(:find).with('999').and_return(double(Adherent::Member))
|
38
|
-
get :show, {id:'999'}
|
39
|
-
end
|
40
|
-
|
42
|
+
|
41
43
|
it 'assigne le membre et rend la vue' do
|
42
|
-
|
43
|
-
|
44
|
-
expect(assigns[:member]).to eq(@m)
|
44
|
+
get :show, {id:adherent_members(:Durand).to_param}
|
45
|
+
expect(assigns[:member]).to eq(adherent_members(:Durand))
|
45
46
|
expect(response).to render_template('show')
|
46
47
|
end
|
47
48
|
end
|
@@ -57,15 +58,11 @@ describe Adherent::MembersController, :type => :controller do
|
|
57
58
|
end
|
58
59
|
|
59
60
|
describe "GET edit" do
|
60
|
-
it 'appelle le membre' do
|
61
|
-
expect(Adherent::Member).to receive(:find).with('999').and_return(double(Adherent::Member))
|
62
|
-
get :edit, {id:'999'}
|
63
|
-
end
|
64
61
|
|
62
|
+
|
65
63
|
it 'assigne le membre et rend la vue' do
|
66
|
-
|
67
|
-
|
68
|
-
expect(assigns[:member]).to eq(@m)
|
64
|
+
get :edit, {id:adherent_members(:Durand).to_param}
|
65
|
+
expect(assigns[:member]).to eq(adherent_members(:Durand))
|
69
66
|
expect(response).to render_template('edit')
|
70
67
|
end
|
71
68
|
end
|
@@ -73,10 +70,10 @@ describe Adherent::MembersController, :type => :controller do
|
|
73
70
|
describe "POST create" do
|
74
71
|
|
75
72
|
before(:each) do
|
76
|
-
@attrib = {name:'Dupont', forname:'Jules', number:'
|
73
|
+
@attrib = {name:'Dupont', forname:'Jules', number:'A55'}
|
77
74
|
end
|
78
75
|
|
79
|
-
it 'redirige vers
|
76
|
+
it 'redirige vers la saisie des coordonnées en cas de succès' do
|
80
77
|
post :create, :member=>@attrib
|
81
78
|
expect(response).to redirect_to(new_member_coord_url(assigns[:member]))
|
82
79
|
end
|
@@ -91,7 +88,7 @@ describe Adherent::MembersController, :type => :controller do
|
|
91
88
|
post :create, :member=>@attrib
|
92
89
|
expect(assigns[:member].name).to eq('Dupont')
|
93
90
|
expect(assigns[:member].forname).to eq('Jules')
|
94
|
-
expect(assigns[:member].number).to eq('
|
91
|
+
expect(assigns[:member].number).to eq('A55')
|
95
92
|
end
|
96
93
|
|
97
94
|
it 'on peut enregistrer une date' do
|
@@ -107,31 +104,23 @@ describe Adherent::MembersController, :type => :controller do
|
|
107
104
|
describe "POST update" do
|
108
105
|
|
109
106
|
before(:each) do
|
110
|
-
@member =
|
111
|
-
@member.organism_id = 1
|
112
|
-
puts @member.errors.messages unless @member.valid?
|
113
|
-
@member.save
|
114
|
-
allow(Adherent::Member).to receive(:find).with(@member.to_param).
|
115
|
-
and_return @member
|
107
|
+
@member = adherent_members(:Dupont)
|
116
108
|
end
|
117
|
-
|
118
|
-
|
119
|
-
|
109
|
+
|
120
110
|
it 'appelle update_attributes' do
|
121
|
-
expect(@member).to receive(:update_attributes).with({'name'=>'Dalton'}).and_return true
|
122
111
|
post :update, {id:@member.to_param, :member=>{:name=>'Dalton'} }
|
112
|
+
expect(@member.reload.name).to eq 'Dalton'
|
123
113
|
end
|
124
114
|
|
125
115
|
it 'redirige vers show en cas de succès' do
|
126
|
-
|
116
|
+
# allow(@member).to receive(:update_attributes).and_return true
|
127
117
|
post :update, {id:@member.to_param, :member=>{:name=>'Dalton'} }
|
128
118
|
expect(response).to redirect_to(member_url(@member))
|
129
119
|
end
|
130
120
|
|
131
121
|
it 'et vers la vue edit autrement' do
|
132
|
-
|
133
|
-
|
134
|
-
expect(response).to render_template 'edit'
|
122
|
+
post :update, {id:@member.to_param, :member=>{:number=>'A002'} }
|
123
|
+
expect(response).to render_template 'edit'
|
135
124
|
end
|
136
125
|
|
137
126
|
it 'la variable @member est assignée' do
|
@@ -141,22 +130,20 @@ describe Adherent::MembersController, :type => :controller do
|
|
141
130
|
end
|
142
131
|
end
|
143
132
|
|
144
|
-
describe "DELETE destroy"
|
133
|
+
describe "DELETE destroy" do
|
145
134
|
|
146
135
|
before(:each) do
|
147
|
-
@member =
|
136
|
+
@member = adherent_members(:Dupont)
|
137
|
+
@nb_members = Adherent::Member.count
|
148
138
|
end
|
149
139
|
|
150
|
-
|
151
|
-
|
152
|
-
expect(Adherent::Member).to
|
153
|
-
|
154
|
-
|
155
|
-
end
|
140
|
+
it 'détruit le member demandé' do
|
141
|
+
delete :destroy, {:id=>@member.to_param}
|
142
|
+
expect(Adherent::Member.count).to eq(@nb_members-1)
|
143
|
+
expect {Adherent::Member.find(1)}.to raise_error(ActiveRecord::RecordNotFound)
|
144
|
+
end
|
156
145
|
|
157
|
-
it '
|
158
|
-
allow(Adherent::Member).to receive(:find).with(@member.to_param).and_return @member
|
159
|
-
expect(@member).to receive(:destroy).and_return true
|
146
|
+
it 'et redirige vers la vue index' do
|
160
147
|
delete :destroy, {:id=>@member.to_param}
|
161
148
|
expect(response).to redirect_to members_url
|
162
149
|
end
|
@@ -4,28 +4,25 @@ require 'rails_helper'
|
|
4
4
|
|
5
5
|
describe Adherent::PaymentsController, :type => :controller do
|
6
6
|
|
7
|
+
fixtures :all
|
8
|
+
|
7
9
|
before(:each) do
|
8
10
|
@routes = Adherent::Engine.routes
|
9
|
-
@member =
|
10
|
-
allow(Adherent::Member).to receive(:find).with(@member.to_param).and_return @member
|
11
|
+
@member = adherent_members(:Dupont)
|
11
12
|
allow(@controller).to receive(:guess_date).and_return Date.today
|
12
13
|
end
|
13
14
|
|
14
15
|
|
15
16
|
describe "GET index" do
|
16
|
-
|
17
|
+
|
17
18
|
it 'rend la vue index' do
|
18
|
-
allow(@member).to receive(:payments)
|
19
19
|
get :index, member_id:@member.to_param
|
20
20
|
expect(response).to render_template("index")
|
21
21
|
end
|
22
|
-
|
23
22
|
|
24
23
|
it "assigns all coords as @coords" do
|
25
|
-
expect(@member).to receive(:payments).and_return [1,2]
|
26
24
|
get :index, member_id:@member.to_param
|
27
|
-
expect(assigns(:payments)).to eq(
|
28
|
-
|
25
|
+
expect(assigns(:payments)).to eq(@member.payments)
|
29
26
|
end
|
30
27
|
end
|
31
28
|
|
@@ -34,12 +31,9 @@ describe Adherent::PaymentsController, :type => :controller do
|
|
34
31
|
describe 'GET new' do
|
35
32
|
|
36
33
|
it 'assigne un payments et rend la vue new' do
|
37
|
-
|
38
|
-
expect(@member).to receive(:payments).and_return(@ar = double(Arel))
|
39
|
-
expect(@member).to receive(:unpaid_amount).and_return 57
|
40
|
-
expect(@ar).to receive(:new).with(date:Date.today, amount:57).and_return(@pay = double(Adherent::Payment))
|
41
34
|
get :new, member_id:@member.to_param
|
42
|
-
expect(assigns[:payment]).to
|
35
|
+
expect(assigns[:payment]).to be_a_new(Adherent::Payment)
|
36
|
+
expect(assigns[:payment].member_id).to eq @member.id
|
43
37
|
expect(response).to render_template('new')
|
44
38
|
end
|
45
39
|
|
@@ -53,40 +47,33 @@ describe Adherent::PaymentsController, :type => :controller do
|
|
53
47
|
end
|
54
48
|
|
55
49
|
it 'crée une nouvelle adhésion avec les params' do
|
56
|
-
expect
|
57
|
-
|
58
|
-
|
59
|
-
post :create, {member_id:@member.to_param, :payment=>@attrib}
|
50
|
+
expect {
|
51
|
+
post :create, {member_id:@member.to_param, :payment=>@attrib} }.
|
52
|
+
to change {Adherent::Payment.count}.by 1
|
60
53
|
|
61
54
|
end
|
62
55
|
|
63
56
|
it 'renvoie vers la vue des adhésions' do
|
64
|
-
allow(@member).to receive(:payments).and_return(@ar = double(Arel))
|
65
|
-
allow(@ar).to receive(:new).and_return(@pay = double(Adherent::Payment))
|
66
|
-
allow(@pay).to receive(:save).and_return true
|
67
57
|
post :create, {member_id:@member.to_param, :payment=>@attrib}
|
68
|
-
expect(response).to redirect_to(member_payments_url(
|
58
|
+
expect(response).to redirect_to(member_payments_url(@member))
|
69
59
|
end
|
70
60
|
|
71
61
|
it 'et vers la vue new autrement' do
|
72
|
-
|
73
|
-
|
74
|
-
allow(@pay).to receive(:save).and_return false
|
75
|
-
post :create, {member_id:@member.to_param, :payment=>@attrib}
|
62
|
+
post :create, {member_id:@member.to_param,
|
63
|
+
:payment=>{'mode'=>'CB', 'date'=>I18n.l(Date.today) } }
|
76
64
|
expect(response).to render_template('new')
|
77
65
|
end
|
78
66
|
|
79
67
|
|
80
68
|
end
|
81
69
|
|
82
|
-
describe "GET show"
|
70
|
+
describe "GET show" do
|
83
71
|
|
84
72
|
it 'rend la vue show' do
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
expect(assigns[:payment]).to eq(@pay)
|
73
|
+
m = adherent_members(:Fidele)
|
74
|
+
pay = adherent_payments(:pay_2)
|
75
|
+
get :show, member_id:m.to_param , id:pay.to_param
|
76
|
+
expect(assigns[:payment]).to eq(pay)
|
90
77
|
expect(response).to render_template('show')
|
91
78
|
end
|
92
79
|
end
|