fine_print 2.2.1 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcbddbda8f319b3de8575f7606cdea1e33ac4f61
4
- data.tar.gz: 22e477666c2247c00cd047b2bfbc00e5e7a0af2b
3
+ metadata.gz: bb595ef06e5a4534032ca5b53a451bf643d55057
4
+ data.tar.gz: 448f987e0838f6db8ee5ceca70b94b292d2583d1
5
5
  SHA512:
6
- metadata.gz: 2d172b728f2da71023fcfb7d2baa41cc4eb9df1300b6cda372703c45e173d45c0b32289d7a380ec39edec6e4eaf01523c0c2103e62d5961f33786fd87832bbb5
7
- data.tar.gz: 8bf001080b71e4b603613207519360ed3245fd395f9371ad84e3eadcb4d0a7b8cfb64c11c0674863c5f72600c7c0d173fbae5c50f68904a1cb1d57db17a543cb
6
+ metadata.gz: 0a4d7b6f294854009c55012c8045fbb1f48ae9809cd1c5f6e3acb106f8d268de6473aa1aa6755598ff5003f4b56ed3b7fe358f3933e2c3bd25b82b02656b6e1b
7
+ data.tar.gz: b0ee996920455b6354e66eafb088fc34ab10ffbbe282a6323a4b02644594b5ec652534e32168f4e1eeb21bc7c80f666b78e72c3674a69cf3dddb70b50725618b
@@ -1,3 +1,5 @@
1
+ require 'responders'
2
+
1
3
  module FinePrint
2
4
  class ApplicationController < ActionController::Base
3
5
  respond_to :html
@@ -15,7 +17,7 @@ module FinePrint
15
17
  end
16
18
 
17
19
  def can_manage
18
- with_interceptor { instance_exec @user, &FinePrint.can_manage_proc }
20
+ instance_exec @user, &FinePrint.can_manage_proc
19
21
  end
20
22
  end
21
23
  end
@@ -2,8 +2,6 @@ module FinePrint
2
2
  class SignaturesController < FinePrint::ApplicationController
3
3
  include FinePrint::ApplicationHelper
4
4
 
5
- acts_as_interceptor :override_url_options => true
6
-
7
5
  skip_before_filter :can_manage, :only => [:new, :create]
8
6
  before_filter :can_sign, :only => [:new, :create]
9
7
  before_filter :get_contract, :only => [:index, :new, :create]
@@ -29,7 +27,7 @@ module FinePrint
29
27
  @signature.contract = @contract
30
28
 
31
29
  if @signature.save
32
- redirect_back
30
+ fine_print_return
33
31
  else
34
32
  render :action => 'new', :alert => merge_errors_for(@signature)
35
33
  end
@@ -46,7 +44,7 @@ module FinePrint
46
44
  protected
47
45
 
48
46
  def can_sign
49
- with_interceptor { instance_exec @user, &FinePrint.can_sign_proc }
47
+ instance_exec @user, &FinePrint.can_sign_proc
50
48
  end
51
49
 
52
50
  def get_contract
@@ -45,9 +45,13 @@ FinePrint.configure do |config|
45
45
  # The `contract_ids` variable contains the contract ids that need to be signed.
46
46
  # The default redirects users to FinePrint's contract signing views.
47
47
  # The `fine_print_return` method can be used to return from a redirect made here.
48
- # Default: lambda { |user, contract_ids| with_interceptor { redirect_to(
49
- # fine_print.new_contract_signature_path(:contract_id => contract_ids.first)) } }
48
+ # Default: lambda { |user, contract_ids|
49
+ # redirect_to(fine_print.new_contract_signature_path(
50
+ # :contract_id => contract_ids.first
51
+ # ))
52
+ # }
50
53
  config.must_sign_proc = lambda { |user, contract_ids| redirect_to(
51
- fine_print.new_contract_signature_path(:contract_id => contract_ids.first)) }
54
+ fine_print.new_contract_signature_path(:contract_id => contract_ids.first)
55
+ ) }
52
56
 
53
57
  end
@@ -13,14 +13,16 @@ module FinePrint
13
13
  blk = options[:must_sign_proc] || FinePrint.must_sign_proc
14
14
 
15
15
  # Use action_interceptor to save the current url
16
- with_interceptor { instance_exec user, contract_ids, &blk }
16
+ store_url key: :fine_print_return_to
17
+
18
+ instance_exec user, contract_ids, &blk
17
19
  end
18
20
 
19
21
  # Accepts no arguments
20
22
  # Redirects the user back to the url they were at before
21
23
  # one of FinePrint's procs redirected them
22
24
  def fine_print_return
23
- redirect_back
25
+ redirect_back key: :fine_print_return_to
24
26
  end
25
27
 
26
28
  protected
@@ -1,3 +1,3 @@
1
1
  module FinePrint
2
- VERSION = '2.2.1'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -11,32 +11,32 @@ module FinePrint
11
11
  let!(:contract) { FactoryGirl.create(:fine_print_contract) }
12
12
 
13
13
  it "won't get index unless authorized" do
14
- get :index, :use_route => :fine_print
14
+ get :index
15
15
  expect(response.status).to eq 403
16
16
 
17
17
  sign_in @user
18
- get :index, :use_route => :fine_print
18
+ get :index
19
19
  expect(response.status).to eq 403
20
20
  end
21
21
 
22
22
  it 'must get index if authorized' do
23
23
  sign_in @admin
24
- get :index, :use_route => :fine_print
24
+ get :index
25
25
  expect(response.status).to eq 200
26
26
  end
27
27
 
28
28
  it "won't get new unless authorized" do
29
- get :new, :use_route => :fine_print
29
+ get :new
30
30
  expect(response.status).to eq 403
31
31
 
32
32
  sign_in @user
33
- get :new, :use_route => :fine_print
33
+ get :new
34
34
  expect(response.status).to eq 403
35
35
  end
36
36
 
37
37
  it 'must get new if authorized' do
38
38
  sign_in @admin
39
- get :new, :use_route => :fine_print
39
+ get :new
40
40
  expect(response.status).to eq 200
41
41
  end
42
42
 
@@ -46,12 +46,12 @@ module FinePrint
46
46
  attributes[:title] = 'Some title'
47
47
  attributes[:content] = 'Some content'
48
48
 
49
- post :create, :contract => :attributes, :use_route => :fine_print
49
+ post :create, :contract => :attributes
50
50
  expect(response.status).to eq 403
51
51
  expect(assigns(:contract)).to be_nil
52
52
 
53
53
  sign_in @user
54
- post :create, :contract => :attributes, :use_route => :fine_print
54
+ post :create, :contract => :attributes
55
55
  expect(response.status).to eq 403
56
56
  expect(assigns(:contract)).to be_nil
57
57
  end
@@ -63,7 +63,7 @@ module FinePrint
63
63
  attributes[:title] = 'Some title'
64
64
  attributes[:content] = 'Some content'
65
65
 
66
- post :create, :contract => attributes, :use_route => :fine_print
66
+ post :create, :contract => attributes
67
67
  expect(response).to redirect_to assigns(:contract)
68
68
  expect(assigns(:contract).errors).to be_empty
69
69
  expect(assigns(:contract).name).to eq 'some_name'
@@ -72,17 +72,17 @@ module FinePrint
72
72
  end
73
73
 
74
74
  it "won't edit unless authorized" do
75
- get :edit, :id => contract.id, :use_route => :fine_print
75
+ get :edit, :id => contract.id
76
76
  expect(response.status).to eq 403
77
77
 
78
78
  sign_in @user
79
- get :edit, :id => contract.id, :use_route => :fine_print
79
+ get :edit, :id => contract.id
80
80
  expect(response.status).to eq 403
81
81
  end
82
82
 
83
83
  it 'must edit if authorized' do
84
84
  sign_in @admin
85
- get :edit, :id => contract.id, :use_route => :fine_print
85
+ get :edit, :id => contract.id
86
86
  expect(response.status).to eq 200
87
87
  end
88
88
 
@@ -95,7 +95,7 @@ module FinePrint
95
95
  title = contract.title
96
96
  content = contract.content
97
97
 
98
- put :update, :id => contract.id, :contract => attributes, :use_route => :fine_print
98
+ put :update, :id => contract.id, :contract => attributes
99
99
  expect(response.status).to eq 403
100
100
  contract.reload
101
101
  expect(contract.name).to eq name
@@ -103,7 +103,7 @@ module FinePrint
103
103
  expect(contract.content).to eq content
104
104
 
105
105
  sign_in @user
106
- put :update, :id => contract.id, :contract => attributes, :use_route => :fine_print
106
+ put :update, :id => contract.id, :contract => attributes
107
107
  expect(response.status).to eq 403
108
108
  contract.reload
109
109
  expect(contract.name).to eq name
@@ -118,7 +118,7 @@ module FinePrint
118
118
  attributes[:content] = 'Another content'
119
119
 
120
120
  sign_in @admin
121
- put :update, :id => contract.id, :contract => attributes, :use_route => :fine_print
121
+ put :update, :id => contract.id, :contract => attributes
122
122
  expect(response).to redirect_to contract
123
123
  contract.reload
124
124
  expect(contract.errors).to be_empty
@@ -128,32 +128,32 @@ module FinePrint
128
128
  end
129
129
 
130
130
  it "won't destroy unless authorized" do
131
- delete :destroy, :id => contract.id, :use_route => :fine_print
131
+ delete :destroy, :id => contract.id
132
132
  expect(response.status).to eq 403
133
133
  expect(Contract.find(contract.id)).to eq contract
134
134
 
135
135
  sign_in @user
136
- delete :destroy, :id => contract.id, :use_route => :fine_print
136
+ delete :destroy, :id => contract.id
137
137
  expect(response.status).to eq 403
138
138
  expect(Contract.find(contract.id)).to eq contract
139
139
  end
140
140
 
141
141
  it 'must destroy if authorized' do
142
142
  sign_in @admin
143
- delete :destroy, :id => contract.id, :use_route => :fine_print
143
+ delete :destroy, :id => contract.id
144
144
  expect(response).to redirect_to contracts_path
145
145
  expect(Contract.find_by_id(contract.id)).to be_nil
146
146
  end
147
147
 
148
148
  it "won't publish unless authorized" do
149
149
  expect(contract.is_published?).to eq false
150
- put :publish, :id => contract.id, :use_route => :fine_print
150
+ put :publish, :id => contract.id
151
151
  expect(response.status).to eq 403
152
152
  contract.reload
153
153
  expect(contract.is_published?).to eq false
154
154
 
155
155
  sign_in @user
156
- put :publish, :id => contract.id, :use_route => :fine_print
156
+ put :publish, :id => contract.id
157
157
  expect(response.status).to eq 403
158
158
  contract.reload
159
159
  expect(contract.is_published?).to eq false
@@ -163,7 +163,7 @@ module FinePrint
163
163
  expect(contract.is_published?).to eq false
164
164
  sign_in @admin
165
165
 
166
- put :publish, :id => contract.id, :use_route => :fine_print
166
+ put :publish, :id => contract.id
167
167
  expect(response).to redirect_to contracts_path
168
168
  contract.reload
169
169
  expect(contract.is_published?).to eq true
@@ -172,13 +172,13 @@ module FinePrint
172
172
  it "won't unpublish unless authorized" do
173
173
  contract.publish
174
174
  expect(contract.is_published?).to eq true
175
- put :unpublish, :id => contract.id, :use_route => :fine_print
175
+ put :unpublish, :id => contract.id
176
176
  expect(response.status).to eq 403
177
177
  contract.reload
178
178
  expect(contract.is_published?).to eq true
179
179
 
180
180
  sign_in @user
181
- put :unpublish, :id => contract.id, :use_route => :fine_print
181
+ put :unpublish, :id => contract.id
182
182
  expect(response.status).to eq 403
183
183
  contract.reload
184
184
  expect(contract.is_published?).to eq true
@@ -189,7 +189,7 @@ module FinePrint
189
189
  expect(contract.is_published?).to eq true
190
190
 
191
191
  sign_in @admin
192
- put :unpublish, :id => contract.id, :use_route => :fine_print
192
+ put :unpublish, :id => contract.id
193
193
  expect(response).to redirect_to contracts_path
194
194
  contract.reload
195
195
  expect(contract.is_published?).to eq false
@@ -199,12 +199,12 @@ module FinePrint
199
199
  contract.publish
200
200
  expect(contract.is_published?).to eq true
201
201
 
202
- post :new_version, :id => contract.id, :use_route => :fine_print
202
+ post :new_version, :id => contract.id
203
203
  expect(response.status).to eq 403
204
204
  expect(assigns(:contract)).to be_nil
205
205
 
206
206
  sign_in @user
207
- post :new_version, :id => contract.id, :use_route => :fine_print
207
+ post :new_version, :id => contract.id
208
208
  expect(response.status).to eq 403
209
209
  expect(assigns(:contract)).to be_nil
210
210
  end
@@ -214,7 +214,7 @@ module FinePrint
214
214
  expect(contract.is_published?).to eq true
215
215
 
216
216
  sign_in @admin
217
- post :new_version, :id => contract.id, :use_route => :fine_print
217
+ post :new_version, :id => contract.id
218
218
  expect(response.status).to eq 200
219
219
  expect(assigns(:contract)).not_to be_nil
220
220
  end
@@ -9,18 +9,18 @@ module FinePrint
9
9
  end
10
10
 
11
11
  it "won't get index unless authorized" do
12
- get :index, :use_route => :fine_print
12
+ get :index
13
13
  expect(response.status).to eq 403
14
14
 
15
15
  sign_in @user
16
- get :index, :use_route => :fine_print
16
+ get :index
17
17
  expect(response.status).to eq 403
18
18
  end
19
19
 
20
20
  it 'must get index if authorized' do
21
21
  sign_in @user
22
22
  @user.is_admin = true
23
- get :index, :use_route => :fine_print
23
+ get :index
24
24
  expect(response).to redirect_to contracts_path
25
25
  end
26
26
  end
@@ -11,61 +11,56 @@ module FinePrint
11
11
  let!(:signature) { FactoryGirl.create(:fine_print_signature) }
12
12
 
13
13
  it "won't get index unless authorized" do
14
- get :index, :contract_id => signature.contract.id, :use_route => :fine_print
14
+ get :index, :contract_id => signature.contract.id
15
15
  expect(response.status).to eq 403
16
16
 
17
17
  sign_in @user
18
- get :index, :contract_id => signature.contract.id, :use_route => :fine_print
18
+ get :index, :contract_id => signature.contract.id
19
19
  expect(response.status).to eq 403
20
20
  end
21
21
 
22
22
  it 'must get index if authorized' do
23
23
  sign_in @admin
24
- get :index, :contract_id => signature.contract.id,
25
- :use_route => :fine_print
24
+ get :index, :contract_id => signature.contract.id
26
25
  expect(response.status).to eq 200
27
26
  end
28
27
 
29
28
  it "won't get new unless signed in" do
30
- get :new, :contract_id => signature.contract.id,
31
- :use_route => :fine_print
29
+ get :new, :contract_id => signature.contract.id
32
30
  expect(response.status).to eq 401
33
31
  end
34
32
 
35
33
  it 'must get new if signed in' do
36
34
  sign_in @user
37
- get :new, :contract_id => signature.contract.id,
38
- :use_route => :fine_print
35
+ get :new, :contract_id => signature.contract.id
39
36
  expect(response.status).to eq 200
40
37
  end
41
38
 
42
39
  it "won't create unless signed in" do
43
- post :create, :contract_id => signature.contract.id,
44
- :use_route => :fine_print
40
+ post :create, :contract_id => signature.contract.id
45
41
  expect(response.status).to eq 401
46
42
  end
47
43
 
48
44
  it 'must create if signed in' do
49
45
  sign_in @user
50
- get :new, :contract_id => signature.contract.id,
51
- :use_route => :fine_print
46
+ get :new, :contract_id => signature.contract.id
52
47
  expect(response.status).to eq 200
53
48
  end
54
49
 
55
50
  it "won't destroy unless authorized" do
56
- delete :destroy, :id => signature.id, :use_route => :fine_print
51
+ delete :destroy, :id => signature.id
57
52
  expect(response.status).to eq 403
58
53
  expect(Signature.find(signature.id)).to eq signature
59
54
 
60
55
  sign_in @user
61
- delete :destroy, :id => signature.id, :use_route => :fine_print
56
+ delete :destroy, :id => signature.id
62
57
  expect(response.status).to eq 403
63
58
  expect(Signature.find(signature.id)).to eq signature
64
59
  end
65
60
 
66
61
  it 'must destroy if authorized' do
67
62
  sign_in @admin
68
- delete :destroy, :id => signature.id, :use_route => :fine_print
63
+ delete :destroy, :id => signature.id
69
64
  expect(response).to redirect_to contract_signatures_path(signature.contract)
70
65
  expect(Signature.find_by_id(signature.id)).to be_nil
71
66
  end
@@ -20,7 +20,7 @@ Dummy::Application.configure do
20
20
  # config.action_dispatch.rack_cache = true
21
21
 
22
22
  # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_assets = false
23
+ config.serve_static_files = false
24
24
 
25
25
  # Compress JavaScripts and CSS.
26
26
  config.assets.js_compressor = :uglifier
@@ -13,7 +13,7 @@ Dummy::Application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
16
+ config.serve_static_files = true
17
17
  config.static_cache_control = "public, max-age=3600"
18
18
 
19
19
  # Show full error reports and disable caching.
Binary file