fine_print 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/initializers/fine_print.rb +3 -3
- data/lib/fine_print/version.rb +1 -1
- data/spec/controllers/contracts_controller_spec.rb +38 -40
- data/spec/controllers/home_controller_spec.rb +4 -4
- data/spec/controllers/signatures_controller_spec.rb +10 -12
- data/spec/dummy/config/initializers/fine_print.rb +1 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +5445 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb6d09c85c20be2b0312861169f2aecd74a85aa
|
4
|
+
data.tar.gz: 604d154a8c0a3251e736c9939d93ab4b158e578f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9814e631196a906b8b1604a132c3d838cc1a00189dd890669fb6677af55879eb6732d421d7397c6c74b77b2c902012e28094873eb82b08e6003020fe85ffe928
|
7
|
+
data.tar.gz: 47badd0b0fbcea2f4a23314b08eb155979e2985c0d95d992a65f7553ee084dda6d4ef0cc6573e2f98adb71fdf075eed276fcbd5ae76e48aa446b03e757abc8c5
|
@@ -22,9 +22,9 @@ FinePrint.configure do |config|
|
|
22
22
|
# This proc is called to check that the given user is allowed to sign contracts.
|
23
23
|
# Should raise and exception, render or redirect unless the user can sign contracts.
|
24
24
|
# You might want to redirect users to a login page if they are not signed in.
|
25
|
-
# The default renders
|
26
|
-
# Default: lambda { |user| !user.nil? || head(:
|
27
|
-
config.can_sign_proc = lambda { |user| !user.nil? || head(:
|
25
|
+
# The default renders 401 Unauthorized for nil users.
|
26
|
+
# Default: lambda { |user| !user.nil? || head(:unauthorized) }
|
27
|
+
config.can_sign_proc = lambda { |user| !user.nil? || head(:unauthorized) }
|
28
28
|
|
29
29
|
# Controller Configuration
|
30
30
|
|
data/lib/fine_print/version.rb
CHANGED
@@ -11,12 +11,12 @@ module FinePrint
|
|
11
11
|
let!(:contract) { FactoryGirl.create(:fine_print_contract) }
|
12
12
|
|
13
13
|
it "won't get index unless authorized" do
|
14
|
-
|
15
|
-
|
14
|
+
get :index, :use_route => :fine_print
|
15
|
+
expect(response.status).to eq 403
|
16
16
|
|
17
17
|
sign_in @user
|
18
|
-
|
19
|
-
|
18
|
+
get :index, :use_route => :fine_print
|
19
|
+
expect(response.status).to eq 403
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'must get index if authorized' do
|
@@ -26,12 +26,12 @@ module FinePrint
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "won't get new unless authorized" do
|
29
|
-
|
30
|
-
|
29
|
+
get :new, :use_route => :fine_print
|
30
|
+
expect(response.status).to eq 403
|
31
31
|
|
32
32
|
sign_in @user
|
33
|
-
|
34
|
-
.to
|
33
|
+
get :new, :use_route => :fine_print
|
34
|
+
expect(response.status).to eq 403
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'must get new if authorized' do
|
@@ -45,14 +45,14 @@ module FinePrint
|
|
45
45
|
attributes[:name] = 'some_name'
|
46
46
|
attributes[:title] = 'Some title'
|
47
47
|
attributes[:content] = 'Some content'
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
|
49
|
+
post :create, :contract => :attributes, :use_route => :fine_print
|
50
|
+
expect(response.status).to eq 403
|
51
51
|
expect(assigns(:contract)).to be_nil
|
52
52
|
|
53
53
|
sign_in @user
|
54
|
-
|
55
|
-
|
54
|
+
post :create, :contract => :attributes, :use_route => :fine_print
|
55
|
+
expect(response.status).to eq 403
|
56
56
|
expect(assigns(:contract)).to be_nil
|
57
57
|
end
|
58
58
|
|
@@ -72,12 +72,12 @@ module FinePrint
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "won't edit unless authorized" do
|
75
|
-
|
76
|
-
|
75
|
+
get :edit, :id => contract.id, :use_route => :fine_print
|
76
|
+
expect(response.status).to eq 403
|
77
77
|
|
78
78
|
sign_in @user
|
79
|
-
|
80
|
-
|
79
|
+
get :edit, :id => contract.id, :use_route => :fine_print
|
80
|
+
expect(response.status).to eq 403
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'must edit if authorized' do
|
@@ -95,18 +95,16 @@ module FinePrint
|
|
95
95
|
title = contract.title
|
96
96
|
content = contract.content
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
.to raise_error(ActionController::RoutingError)
|
98
|
+
put :update, :id => contract.id, :contract => attributes, :use_route => :fine_print
|
99
|
+
expect(response.status).to eq 403
|
101
100
|
contract.reload
|
102
101
|
expect(contract.name).to eq name
|
103
102
|
expect(contract.title).to eq title
|
104
103
|
expect(contract.content).to eq content
|
105
104
|
|
106
105
|
sign_in @user
|
107
|
-
|
108
|
-
|
109
|
-
.to raise_error(ActionController::RoutingError)
|
106
|
+
put :update, :id => contract.id, :contract => attributes, :use_route => :fine_print
|
107
|
+
expect(response.status).to eq 403
|
110
108
|
contract.reload
|
111
109
|
expect(contract.name).to eq name
|
112
110
|
expect(contract.title).to eq title
|
@@ -130,13 +128,13 @@ module FinePrint
|
|
130
128
|
end
|
131
129
|
|
132
130
|
it "won't destroy unless authorized" do
|
133
|
-
|
134
|
-
|
131
|
+
delete :destroy, :id => contract.id, :use_route => :fine_print
|
132
|
+
expect(response.status).to eq 403
|
135
133
|
expect(Contract.find(contract.id)).to eq contract
|
136
134
|
|
137
135
|
sign_in @user
|
138
|
-
|
139
|
-
|
136
|
+
delete :destroy, :id => contract.id, :use_route => :fine_print
|
137
|
+
expect(response.status).to eq 403
|
140
138
|
expect(Contract.find(contract.id)).to eq contract
|
141
139
|
end
|
142
140
|
|
@@ -149,14 +147,14 @@ module FinePrint
|
|
149
147
|
|
150
148
|
it "won't publish unless authorized" do
|
151
149
|
expect(contract.is_published?).to eq false
|
152
|
-
|
153
|
-
|
150
|
+
put :publish, :id => contract.id, :use_route => :fine_print
|
151
|
+
expect(response.status).to eq 403
|
154
152
|
contract.reload
|
155
153
|
expect(contract.is_published?).to eq false
|
156
154
|
|
157
155
|
sign_in @user
|
158
|
-
|
159
|
-
|
156
|
+
put :publish, :id => contract.id, :use_route => :fine_print
|
157
|
+
expect(response.status).to eq 403
|
160
158
|
contract.reload
|
161
159
|
expect(contract.is_published?).to eq false
|
162
160
|
end
|
@@ -174,14 +172,14 @@ module FinePrint
|
|
174
172
|
it "won't unpublish unless authorized" do
|
175
173
|
contract.publish
|
176
174
|
expect(contract.is_published?).to eq true
|
177
|
-
|
178
|
-
|
175
|
+
put :unpublish, :id => contract.id, :use_route => :fine_print
|
176
|
+
expect(response.status).to eq 403
|
179
177
|
contract.reload
|
180
178
|
expect(contract.is_published?).to eq true
|
181
179
|
|
182
180
|
sign_in @user
|
183
|
-
|
184
|
-
|
181
|
+
put :unpublish, :id => contract.id, :use_route => :fine_print
|
182
|
+
expect(response.status).to eq 403
|
185
183
|
contract.reload
|
186
184
|
expect(contract.is_published?).to eq true
|
187
185
|
end
|
@@ -201,13 +199,13 @@ module FinePrint
|
|
201
199
|
contract.publish
|
202
200
|
expect(contract.is_published?).to eq true
|
203
201
|
|
204
|
-
|
205
|
-
|
202
|
+
post :new_version, :id => contract.id, :use_route => :fine_print
|
203
|
+
expect(response.status).to eq 403
|
206
204
|
expect(assigns(:contract)).to be_nil
|
207
205
|
|
208
206
|
sign_in @user
|
209
|
-
|
210
|
-
|
207
|
+
post :new_version, :id => contract.id, :use_route => :fine_print
|
208
|
+
expect(response.status).to eq 403
|
211
209
|
expect(assigns(:contract)).to be_nil
|
212
210
|
end
|
213
211
|
|
@@ -216,7 +214,7 @@ module FinePrint
|
|
216
214
|
expect(contract.is_published?).to eq true
|
217
215
|
|
218
216
|
sign_in @admin
|
219
|
-
|
217
|
+
post :new_version, :id => contract.id, :use_route => :fine_print
|
220
218
|
expect(response.status).to eq 200
|
221
219
|
expect(assigns(:contract)).not_to be_nil
|
222
220
|
end
|
@@ -9,12 +9,12 @@ module FinePrint
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "won't get index unless authorized" do
|
12
|
-
|
13
|
-
|
12
|
+
get :index, :use_route => :fine_print
|
13
|
+
expect(response.status).to eq 403
|
14
14
|
|
15
15
|
sign_in @user
|
16
|
-
|
17
|
-
|
16
|
+
get :index, :use_route => :fine_print
|
17
|
+
expect(response.status).to eq 403
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'must get index if authorized' do
|
@@ -11,14 +11,12 @@ module FinePrint
|
|
11
11
|
let!(:signature) { FactoryGirl.create(:fine_print_signature) }
|
12
12
|
|
13
13
|
it "won't get index unless authorized" do
|
14
|
-
|
15
|
-
|
16
|
-
.to raise_error(ActionController::RoutingError)
|
14
|
+
get :index, :contract_id => signature.contract.id, :use_route => :fine_print
|
15
|
+
expect(response.status).to eq 403
|
17
16
|
|
18
17
|
sign_in @user
|
19
|
-
|
20
|
-
|
21
|
-
.to raise_error(ActionController::RoutingError)
|
18
|
+
get :index, :contract_id => signature.contract.id, :use_route => :fine_print
|
19
|
+
expect(response.status).to eq 403
|
22
20
|
end
|
23
21
|
|
24
22
|
it 'must get index if authorized' do
|
@@ -31,7 +29,7 @@ module FinePrint
|
|
31
29
|
it "won't get new unless signed in" do
|
32
30
|
get :new, :contract_id => signature.contract.id,
|
33
31
|
:use_route => :fine_print
|
34
|
-
expect(response.status).to eq
|
32
|
+
expect(response.status).to eq 401
|
35
33
|
end
|
36
34
|
|
37
35
|
it 'must get new if signed in' do
|
@@ -44,7 +42,7 @@ module FinePrint
|
|
44
42
|
it "won't create unless signed in" do
|
45
43
|
post :create, :contract_id => signature.contract.id,
|
46
44
|
:use_route => :fine_print
|
47
|
-
expect(response.status).to eq
|
45
|
+
expect(response.status).to eq 401
|
48
46
|
end
|
49
47
|
|
50
48
|
it 'must create if signed in' do
|
@@ -55,13 +53,13 @@ module FinePrint
|
|
55
53
|
end
|
56
54
|
|
57
55
|
it "won't destroy unless authorized" do
|
58
|
-
|
59
|
-
|
56
|
+
delete :destroy, :id => signature.id, :use_route => :fine_print
|
57
|
+
expect(response.status).to eq 403
|
60
58
|
expect(Signature.find(signature.id)).to eq signature
|
61
59
|
|
62
60
|
sign_in @user
|
63
|
-
|
64
|
-
|
61
|
+
delete :destroy, :id => signature.id, :use_route => :fine_print
|
62
|
+
expect(response.status).to eq 403
|
65
63
|
expect(Signature.find(signature.id)).to eq signature
|
66
64
|
end
|
67
65
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# Configuration file for the dummy app
|
2
2
|
FinePrint.configure do |config|
|
3
|
-
config.can_manage_proc = lambda { |user| user.try(:is_admin) ||
|
4
|
-
raise(ActionController::RoutingError, 'Not Found') }
|
3
|
+
config.can_manage_proc = lambda { |user| user.try(:is_admin) || head(:forbidden) }
|
5
4
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|