abilities 4.0.0.1 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +1 -3
  5. data/lib/abilities/definitions.rb +3 -3
  6. data/lib/abilities/version.rb +1 -1
  7. metadata +12 -114
  8. data/test/dummy/Rakefile +0 -5
  9. data/test/dummy/app/assets/javascripts/application.js +0 -13
  10. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  11. data/test/dummy/app/controllers/application_controller.rb +0 -5
  12. data/test/dummy/app/controllers/products_controller.rb +0 -10
  13. data/test/dummy/app/helpers/application_helper.rb +0 -2
  14. data/test/dummy/app/models/product.rb +0 -2
  15. data/test/dummy/app/models/user.rb +0 -2
  16. data/test/dummy/app/views/layouts/application.html.erb +0 -12
  17. data/test/dummy/app/views/products/show.html.erb +0 -6
  18. data/test/dummy/bin/bundle +0 -4
  19. data/test/dummy/bin/rails +0 -5
  20. data/test/dummy/bin/rake +0 -5
  21. data/test/dummy/bin/setup +0 -30
  22. data/test/dummy/config.ru +0 -4
  23. data/test/dummy/config/abilities.rb +0 -9
  24. data/test/dummy/config/application.rb +0 -25
  25. data/test/dummy/config/boot.rb +0 -5
  26. data/test/dummy/config/database.yml +0 -10
  27. data/test/dummy/config/database.yml.travis +0 -3
  28. data/test/dummy/config/environment.rb +0 -5
  29. data/test/dummy/config/environments/development.rb +0 -41
  30. data/test/dummy/config/environments/production.rb +0 -79
  31. data/test/dummy/config/environments/test.rb +0 -42
  32. data/test/dummy/config/initializers/assets.rb +0 -11
  33. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  34. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  35. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  36. data/test/dummy/config/initializers/inflections.rb +0 -16
  37. data/test/dummy/config/initializers/mime_types.rb +0 -4
  38. data/test/dummy/config/initializers/session_store.rb +0 -3
  39. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  40. data/test/dummy/config/locales/en.yml +0 -23
  41. data/test/dummy/config/routes.rb +0 -3
  42. data/test/dummy/config/secrets.yml +0 -22
  43. data/test/dummy/db/migrate/20140629203344_create_users.rb +0 -9
  44. data/test/dummy/db/migrate/20140629203412_create_products.rb +0 -7
  45. data/test/dummy/db/schema.rb +0 -30
  46. data/test/dummy/log/development.log +0 -116
  47. data/test/dummy/log/test.log +0 -1593
  48. data/test/dummy/public/404.html +0 -61
  49. data/test/dummy/public/422.html +0 -61
  50. data/test/dummy/public/500.html +0 -60
  51. data/test/dummy/public/favicon.ico +0 -0
  52. data/test/generator_test.rb +0 -18
  53. data/test/policy_test.rb +0 -62
  54. data/test/test_helper.rb +0 -13
  55. data/test/view_test.rb +0 -12
@@ -1,61 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>The page you were looking for doesn't exist.</h1>
56
- <p>You may have mistyped the address or the page may have moved.</p>
57
- </div>
58
- <p>If you are the application owner check the logs for more information.</p>
59
- </div>
60
- </body>
61
- </html>
@@ -1,61 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>The change you wanted was rejected.</h1>
56
- <p>Maybe you tried to change something you didn't have access to.</p>
57
- </div>
58
- <p>If you are the application owner check the logs for more information.</p>
59
- </div>
60
- </body>
61
- </html>
@@ -1,60 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>We're sorry, but something went wrong.</h1>
56
- </div>
57
- <p>If you are the application owner check the logs for more information.</p>
58
- </div>
59
- </body>
60
- </html>
File without changes
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/generators'
3
- require 'generators/abilities/install/install_generator'
4
-
5
- class GeneratorsTest < Rails::Generators::TestCase
6
- destination Rails.root.join('tmp')
7
-
8
- teardown do
9
- FileUtils.rm_rf destination_root
10
- end
11
-
12
- test 'install' do
13
- self.class.tests Abilities::Generators::InstallGenerator
14
- run_generator
15
- assert_file 'config/abilities.rb'
16
- end
17
-
18
- end
@@ -1,62 +0,0 @@
1
- require 'test_helper'
2
-
3
- class PolicyTest < ActiveSupport::TestCase
4
-
5
- setup do
6
- @user = User.new
7
- @controller = ProductsController.new
8
- @controller.current_user = @user
9
- @product = Product.new
10
- end
11
-
12
- test 'authorize' do
13
- assert_nothing_raised do
14
- @controller.send :authorize!, :create, @product
15
- end
16
- assert_raises Abilities::AccessDenied do
17
- @controller.send :authorize!, :read, @product
18
- end
19
- end
20
-
21
- test 'any' do
22
- assert can?(:touch, :any)
23
- assert can?(:touch, @product)
24
- assert can?(:touch, @user)
25
- end
26
-
27
- test 'manage' do
28
- assert can?(:manage, @user)
29
- assert can?(:create, @user)
30
- assert can?(:edit, @user)
31
- assert can?(:destroy, @user)
32
- @user = User.new
33
- assert cannot?(:manage, @user)
34
- assert can?(:create, @user)
35
- assert cannot?(:edit, @user)
36
- assert cannot?(:destroy, @user)
37
- end
38
-
39
- test 'multiple' do
40
- assert can?(:create, @product)
41
- assert can?(:create, @user)
42
- assert can?(:view, @product)
43
- assert can?(:list, @product)
44
- end
45
-
46
- test 'cannot' do
47
- assert cannot?(:destroy, @product)
48
- end
49
-
50
- test 'undefined' do
51
- assert cannot?(:undefined, @product)
52
- end
53
-
54
- private
55
-
56
- %i(can? cannot?).each do |name|
57
- define_method name do |action, resource|
58
- @controller.send name, action, resource
59
- end
60
- end
61
-
62
- end
@@ -1,13 +0,0 @@
1
- # Configure Rails Environment
2
- ENV['RAILS_ENV'] = 'test'
3
-
4
- require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
5
- ActiveRecord::Migrator.migrations_paths = [File.expand_path('../../test/dummy/db/migrate', __FILE__)]
6
- require 'rails/test_help'
7
-
8
- # Filter out Minitest backtrace while allowing backtrace from other libraries
9
- # to be shown.
10
- Minitest.backtrace_filter = Minitest::BacktraceFilter.new
11
-
12
- # Load support files
13
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -1,12 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ViewTest < ActionDispatch::IntegrationTest
4
-
5
- test 'helpers' do
6
- get product_path
7
- assert_response :success
8
- assert_select 'a', 'Touch'
9
- assert_select 'a', 'Destroy'
10
- end
11
-
12
- end