fine_print 1.4.1 → 2.0.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 +4 -4
- data/README.md +9 -2
- data/Rakefile +0 -1
- data/app/assets/javascripts/fine_print/application.js +0 -1
- data/app/assets/stylesheets/fine_print/application.css +0 -1
- data/app/controllers/fine_print/application_controller.rb +9 -4
- data/app/controllers/fine_print/contracts_controller.rb +16 -12
- data/app/controllers/fine_print/home_controller.rb +5 -0
- data/app/controllers/fine_print/signatures_controller.rb +44 -2
- data/app/models/fine_print/contract.rb +17 -45
- data/app/models/fine_print/signature.rb +4 -3
- data/app/views/fine_print/contracts/_show.html.erb +11 -0
- data/app/views/fine_print/contracts/edit.html.erb +1 -1
- data/app/views/fine_print/contracts/index.html.erb +12 -14
- data/app/views/fine_print/contracts/new_version.html.erb +1 -1
- data/app/views/fine_print/contracts/show.html.erb +18 -29
- data/app/views/fine_print/signatures/_form.html.erb +21 -0
- data/app/views/fine_print/signatures/index.html.erb +3 -7
- data/app/views/fine_print/signatures/new.html.erb +13 -0
- data/config/initializers/fine_print.rb +36 -33
- data/config/routes.rb +5 -5
- data/db/migrate/0_install_fine_print.rb +2 -3
- data/lib/fine_print/controller_includes.rb +41 -67
- data/lib/fine_print/engine.rb +3 -0
- data/lib/fine_print/version.rb +1 -1
- data/lib/fine_print.rb +48 -57
- data/spec/controllers/contracts_controller_spec.rb +98 -98
- data/spec/controllers/home_controller_spec.rb +7 -5
- data/spec/controllers/signatures_controller_spec.rb +48 -19
- data/spec/dummy/app/models/dummy_user.rb +0 -1
- data/spec/dummy/config/initializers/fine_print.rb +2 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +31970 -0
- data/spec/dummy/log/test.log +71587 -0
- data/spec/lib/fine_print/controller_includes_spec.rb +9 -14
- data/spec/lib/fine_print_spec.rb +15 -9
- data/spec/models/contract_spec.rb +17 -25
- data/spec/models/signature_spec.rb +4 -14
- data/spec/spec_helper.rb +1 -2
- metadata +33 -4
- data/app/views/fine_print/home/index.html.erb +0 -16
- data/lib/fine_print/security_transgression.rb +0 -3
@@ -1,25 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module FinePrint
|
4
|
-
describe HomeController do
|
5
|
-
|
4
|
+
describe HomeController, :type => :controller do
|
5
|
+
routes { FinePrint::Engine.routes }
|
6
|
+
|
7
|
+
before(:each) do
|
6
8
|
setup_controller_spec
|
7
9
|
end
|
8
10
|
|
9
11
|
it "won't get index unless authorized" do
|
10
12
|
expect { get :index, :use_route => :fine_print }
|
11
|
-
.to raise_error(
|
13
|
+
.to raise_error(ActionController::RoutingError)
|
12
14
|
|
13
15
|
sign_in @user
|
14
16
|
expect { get :index, :use_route => :fine_print }
|
15
|
-
.to raise_error(
|
17
|
+
.to raise_error(ActionController::RoutingError)
|
16
18
|
end
|
17
19
|
|
18
20
|
it 'must get index if authorized' do
|
19
21
|
sign_in @user
|
20
22
|
@user.is_admin = true
|
21
23
|
get :index, :use_route => :fine_print
|
22
|
-
|
24
|
+
expect(response).to redirect_to contracts_path
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -1,46 +1,75 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module FinePrint
|
4
|
-
describe SignaturesController do
|
4
|
+
describe SignaturesController, :type => :controller do
|
5
5
|
routes { FinePrint::Engine.routes }
|
6
6
|
|
7
|
-
before do
|
7
|
+
before(:each) do
|
8
8
|
setup_controller_spec
|
9
|
-
@signature = FactoryGirl.create(:signature)
|
10
|
-
@signature.reload
|
11
9
|
end
|
12
10
|
|
11
|
+
let!(:signature) { FactoryGirl.create(:signature) }
|
12
|
+
|
13
13
|
it "won't get index unless authorized" do
|
14
|
-
expect { get :index, :
|
15
|
-
|
14
|
+
expect { get :index, :contract_id => signature.contract.id,
|
15
|
+
:use_route => :fine_print }
|
16
|
+
.to raise_error(ActionController::RoutingError)
|
16
17
|
|
17
18
|
sign_in @user
|
18
|
-
expect { get :index, :
|
19
|
-
|
19
|
+
expect { get :index, :contract_id => signature.contract.id,
|
20
|
+
:use_route => :fine_print }
|
21
|
+
.to raise_error(ActionController::RoutingError)
|
20
22
|
end
|
21
23
|
|
22
24
|
it 'must get index if authorized' do
|
23
25
|
sign_in @admin
|
24
|
-
get :index, :
|
25
|
-
|
26
|
+
get :index, :contract_id => signature.contract.id,
|
27
|
+
:use_route => :fine_print
|
28
|
+
expect(response.status).to eq 200
|
29
|
+
end
|
30
|
+
|
31
|
+
it "won't get new unless signed in" do
|
32
|
+
get :new, :contract_id => signature.contract.id,
|
33
|
+
:use_route => :fine_print
|
34
|
+
expect(response.status).to eq 401
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'must get new if signed in' do
|
38
|
+
sign_in @user
|
39
|
+
get :new, :contract_id => signature.contract.id,
|
40
|
+
:use_route => :fine_print
|
41
|
+
expect(response.status).to eq 200
|
42
|
+
end
|
43
|
+
|
44
|
+
it "won't create unless signed in" do
|
45
|
+
post :create, :contract_id => signature.contract.id,
|
46
|
+
:use_route => :fine_print
|
47
|
+
expect(response.status).to eq 401
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'must create if signed in' do
|
51
|
+
sign_in @user
|
52
|
+
get :new, :contract_id => signature.contract.id,
|
53
|
+
:use_route => :fine_print
|
54
|
+
expect(response.status).to eq 200
|
26
55
|
end
|
27
56
|
|
28
57
|
it "won't destroy unless authorized" do
|
29
|
-
expect { delete :destroy, :id =>
|
30
|
-
.to raise_error(
|
31
|
-
expect(Signature.find(
|
58
|
+
expect { delete :destroy, :id => signature.id, :use_route => :fine_print }
|
59
|
+
.to raise_error(ActionController::RoutingError)
|
60
|
+
expect(Signature.find(signature.id)).to eq signature
|
32
61
|
|
33
62
|
sign_in @user
|
34
|
-
expect { delete :destroy, :id =>
|
35
|
-
.to raise_error(
|
36
|
-
expect(Signature.find(
|
63
|
+
expect { delete :destroy, :id => signature.id, :use_route => :fine_print }
|
64
|
+
.to raise_error(ActionController::RoutingError)
|
65
|
+
expect(Signature.find(signature.id)).to eq signature
|
37
66
|
end
|
38
67
|
|
39
68
|
it 'must destroy if authorized' do
|
40
69
|
sign_in @admin
|
41
|
-
delete :destroy, :id =>
|
42
|
-
|
43
|
-
expect(Signature.find_by_id(
|
70
|
+
delete :destroy, :id => signature.id, :use_route => :fine_print
|
71
|
+
expect(response).to redirect_to contract_signatures_path(signature.contract)
|
72
|
+
expect(Signature.find_by_id(signature.id)).to be_nil
|
44
73
|
end
|
45
74
|
end
|
46
75
|
end
|
Binary file
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|