trust 0.5.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.
- data/MIT-LICENSE +23 -0
- data/README.md +244 -0
- data/Rakefile +37 -0
- data/lib/tasks/trust_tasks.rake +42 -0
- data/lib/trust/active_record.rb +65 -0
- data/lib/trust/authorization.rb +85 -0
- data/lib/trust/controller/properties.rb +134 -0
- data/lib/trust/controller/resource.rb +306 -0
- data/lib/trust/controller.rb +197 -0
- data/lib/trust/exceptions.rb +45 -0
- data/lib/trust/inheritable_attribute.rb +91 -0
- data/lib/trust/permissions.rb +268 -0
- data/lib/trust/test_helper.rb +56 -0
- data/lib/trust/version.rb +27 -0
- data/lib/trust.rb +39 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/accounts.js +2 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/javascripts/clients.js +2 -0
- data/test/dummy/app/assets/javascripts/users.js +2 -0
- data/test/dummy/app/assets/stylesheets/accounts.css +4 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/clients.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/assets/stylesheets/users.css +4 -0
- data/test/dummy/app/controllers/accounts_controller.rb +100 -0
- data/test/dummy/app/controllers/application_controller.rb +31 -0
- data/test/dummy/app/controllers/clients_controller.rb +107 -0
- data/test/dummy/app/controllers/savings_accounts_controller.rb +27 -0
- data/test/dummy/app/controllers/settlements_controller.rb +26 -0
- data/test/dummy/app/controllers/users_controller.rb +107 -0
- data/test/dummy/app/helpers/accounts_helper.rb +26 -0
- data/test/dummy/app/helpers/application_helper.rb +26 -0
- data/test/dummy/app/helpers/clients_helper.rb +26 -0
- data/test/dummy/app/helpers/users_helper.rb +26 -0
- data/test/dummy/app/models/account/credit.rb +26 -0
- data/test/dummy/app/models/account.rb +35 -0
- data/test/dummy/app/models/client.rb +35 -0
- data/test/dummy/app/models/permissions.rb +68 -0
- data/test/dummy/app/models/savings_account.rb +26 -0
- data/test/dummy/app/models/user.rb +40 -0
- data/test/dummy/app/views/accounts/_form.html.erb +46 -0
- data/test/dummy/app/views/accounts/edit.html.erb +31 -0
- data/test/dummy/app/views/accounts/index.html.erb +48 -0
- data/test/dummy/app/views/accounts/new.html.erb +30 -0
- data/test/dummy/app/views/accounts/show.html.erb +35 -0
- data/test/dummy/app/views/clients/_form.html.erb +46 -0
- data/test/dummy/app/views/clients/edit.html.erb +31 -0
- data/test/dummy/app/views/clients/index.html.erb +48 -0
- data/test/dummy/app/views/clients/new.html.erb +30 -0
- data/test/dummy/app/views/clients/show.html.erb +35 -0
- data/test/dummy/app/views/layouts/application.html.erb +39 -0
- data/test/dummy/app/views/users/_form.html.erb +46 -0
- data/test/dummy/app/views/users/edit.html.erb +31 -0
- data/test/dummy/app/views/users/index.html.erb +48 -0
- data/test/dummy/app/views/users/new.html.erb +30 -0
- data/test/dummy/app/views/users/show.html.erb +35 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +38 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20120522115011_create_accounts.rb +36 -0
- data/test/dummy/db/migrate/20120522130322_create_users.rb +33 -0
- data/test/dummy/db/migrate/20120523144144_create_clients.rb +34 -0
- data/test/dummy/db/schema.rb +38 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/accounts.yml +7 -0
- data/test/dummy/test/fixtures/clients.yml +7 -0
- data/test/dummy/test/fixtures/users.yml +7 -0
- data/test/dummy/test/functional/accounts_controller_test.rb +123 -0
- data/test/dummy/test/functional/clients_controller_test.rb +74 -0
- data/test/dummy/test/functional/users_controller_test.rb +74 -0
- data/test/dummy/test/unit/account_test.rb +31 -0
- data/test/dummy/test/unit/client_test.rb +31 -0
- data/test/dummy/test/unit/helpers/accounts_helper_test.rb +28 -0
- data/test/dummy/test/unit/helpers/clients_helper_test.rb +28 -0
- data/test/dummy/test/unit/helpers/users_helper_test.rb +28 -0
- data/test/dummy/test/unit/permissions_test.rb +171 -0
- data/test/dummy/test/unit/user_test.rb +31 -0
- data/test/test_helper.rb +45 -0
- data/test/trust_test.rb +31 -0
- data/test/unit/trust/active_record_test.rb +56 -0
- data/test/unit/trust/authorization_test.rb +108 -0
- data/test/unit/trust/controller/properties_test.rb +132 -0
- data/test/unit/trust/controller/resource_test.rb +251 -0
- data/test/unit/trust/controller_test.rb +160 -0
- data/test/unit/trust/inheritable_attribute_test.rb +65 -0
- data/test/unit/trust/permissions_test.rb +258 -0
- metadata +280 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/404.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/422.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/500.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class AccountsControllerTest < ActionController::TestCase
|
|
28
|
+
context 'with all permissions' do
|
|
29
|
+
setup do
|
|
30
|
+
login_as(:system_admin)
|
|
31
|
+
@client = Client.create
|
|
32
|
+
@account = Account.create(:client_id => @client.id) #accounts(:one)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
should "get index" do
|
|
36
|
+
get :index, client_id: @client
|
|
37
|
+
assert_response :success
|
|
38
|
+
assert_not_nil assigns(:accounts)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
should "get new" do
|
|
42
|
+
get :new, client_id: @client
|
|
43
|
+
assert_response :success
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
should "create account" do
|
|
47
|
+
assert_difference('Account.count') do
|
|
48
|
+
post :create, client_id: @client, account: { name: @account.name }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
assert_redirected_to client_account_path(@client,assigns(:account))
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
should "show account" do
|
|
55
|
+
get :show, client_id: @client, id: @account
|
|
56
|
+
assert_response :success
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
should "get edit" do
|
|
60
|
+
get :edit, client_id: @client, id: @account
|
|
61
|
+
assert_response :success
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
should "update account" do
|
|
65
|
+
put :update, client_id: @client, id: @account, account: { name: @account.name }
|
|
66
|
+
assert_redirected_to client_account_path(assigns(:account))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
should "destroy account" do
|
|
70
|
+
assert_difference('Account.count', -1) do
|
|
71
|
+
delete :destroy, client_id: @client, id: @account
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
assert_redirected_to client_accounts_path
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'with limited permissions' do
|
|
79
|
+
setup do
|
|
80
|
+
login_as(:accountant)
|
|
81
|
+
@client = Client.create
|
|
82
|
+
@account = @client.accounts.create
|
|
83
|
+
flunk unless @account
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
should 'deny access on index' do
|
|
87
|
+
assert_raises Trust::AccessDenied do
|
|
88
|
+
get :index, client_id: @client
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
should 'deny access on new' do
|
|
92
|
+
assert_raises Trust::AccessDenied do
|
|
93
|
+
get :new, client_id: @client
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
should 'deny access on show' do
|
|
97
|
+
assert_raises Trust::AccessDenied do
|
|
98
|
+
get :show, client_id: @client, id: @account
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
should 'deny access on destroy' do
|
|
102
|
+
assert_raises Trust::AccessDenied do
|
|
103
|
+
delete :destroy, client_id: @client, id: @account
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
context 'but having ownership' do
|
|
107
|
+
should 'allow updates' do
|
|
108
|
+
put :update, client_id: @client, id: @account, account: { name: @account.name }
|
|
109
|
+
assert_redirected_to client_account_path(assigns(:account))
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
context 'having no ownership' do
|
|
113
|
+
should 'deny access' do
|
|
114
|
+
login_as(:guest)
|
|
115
|
+
assert_raises Trust::AccessDenied do
|
|
116
|
+
put :update, client_id: @client, id: @account, account: { name: @account.name }
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class ClientsControllerTest < ActionController::TestCase
|
|
28
|
+
setup do
|
|
29
|
+
@client = Client.create #clients(:one)
|
|
30
|
+
login_as(:system_admin)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get index" do
|
|
34
|
+
get :index
|
|
35
|
+
assert_response :success
|
|
36
|
+
assert_not_nil assigns(:clients)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test "should get new" do
|
|
40
|
+
get :new
|
|
41
|
+
assert_response :success
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
test "should create client" do
|
|
45
|
+
assert_difference('Client.count') do
|
|
46
|
+
post :create, client: { name: @client.name }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
assert_redirected_to client_path(assigns(:client))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
test "should show client" do
|
|
53
|
+
get :show, id: @client
|
|
54
|
+
assert_response :success
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
test "should get edit" do
|
|
58
|
+
get :edit, id: @client
|
|
59
|
+
assert_response :success
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
test "should update client" do
|
|
63
|
+
put :update, id: @client, client: { name: @client.name }
|
|
64
|
+
assert_redirected_to client_path(assigns(:client))
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
test "should destroy client" do
|
|
68
|
+
assert_difference('Client.count', -1) do
|
|
69
|
+
delete :destroy, id: @client
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
assert_redirected_to clients_path
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class UsersControllerTest < ActionController::TestCase
|
|
28
|
+
setup do
|
|
29
|
+
@user = User.create #users(:one)
|
|
30
|
+
login_as(:system_admin)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
test "should get index" do
|
|
34
|
+
get :index
|
|
35
|
+
assert_response :success
|
|
36
|
+
assert_not_nil assigns(:users)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test "should get new" do
|
|
40
|
+
get :new
|
|
41
|
+
assert_response :success
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
test "should create user" do
|
|
45
|
+
assert_difference('User.count') do
|
|
46
|
+
post :create, user: { name: @user.name }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
assert_redirected_to user_path(assigns(:user))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
test "should show user" do
|
|
53
|
+
get :show, id: @user
|
|
54
|
+
assert_response :success
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
test "should get edit" do
|
|
58
|
+
get :edit, id: @user
|
|
59
|
+
assert_response :success
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
test "should update user" do
|
|
63
|
+
put :update, id: @user, user: { name: @user.name }
|
|
64
|
+
assert_redirected_to user_path(assigns(:user))
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
test "should destroy user" do
|
|
68
|
+
assert_difference('User.count', -1) do
|
|
69
|
+
delete :destroy, id: @user
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
assert_redirected_to users_path
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class AccountTest < ActiveSupport::TestCase
|
|
28
|
+
# test "the truth" do
|
|
29
|
+
# assert true
|
|
30
|
+
# end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class ClientTest < ActiveSupport::TestCase
|
|
28
|
+
# test "the truth" do
|
|
29
|
+
# assert true
|
|
30
|
+
# end
|
|
31
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class AccountsHelperTest < ActionView::TestCase
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class ClientsHelperTest < ActionView::TestCase
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) 2012 Bingo Entreprenøren AS
|
|
2
|
+
# Copyright (c) 2012 Teknobingo Scandinavia AS
|
|
3
|
+
# Copyright (c) 2012 Knut I. Stenmark
|
|
4
|
+
# Copyright (c) 2012 Patrick Hanevold
|
|
5
|
+
#
|
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
# a copy of this software and associated documentation files (the
|
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
# the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be
|
|
15
|
+
# included in all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
require 'test_helper'
|
|
26
|
+
|
|
27
|
+
class UsersHelperTest < ActionView::TestCase
|
|
28
|
+
end
|