abilities 0.1.2 → 4.0.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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +31 -44
  4. data/Rakefile +1 -14
  5. data/lib/abilities.rb +9 -18
  6. data/lib/abilities/definitions.rb +38 -29
  7. data/lib/abilities/extensions/action_controller/base.rb +28 -0
  8. data/lib/abilities/proxy.rb +6 -7
  9. data/lib/abilities/railtie.rb +4 -3
  10. data/lib/abilities/version.rb +1 -1
  11. data/lib/generators/abilities/install/install_generator.rb +15 -0
  12. data/lib/generators/abilities/{templates/abilities.rb → install/templates/configuration.rb} +0 -0
  13. data/test/dummy/Rakefile +0 -1
  14. data/test/dummy/app/assets/javascripts/application.js +2 -2
  15. data/test/dummy/app/assets/stylesheets/application.css +1 -1
  16. data/test/dummy/app/controllers/products_controller.rb +10 -0
  17. data/test/dummy/app/models/product.rb +2 -0
  18. data/test/dummy/app/models/user.rb +0 -1
  19. data/test/dummy/app/views/layouts/application.html.erb +9 -11
  20. data/test/dummy/app/views/products/show.html.erb +6 -0
  21. data/test/dummy/bin/bundle +1 -0
  22. data/test/dummy/bin/rails +2 -1
  23. data/test/dummy/bin/rake +1 -0
  24. data/test/dummy/bin/setup +30 -0
  25. data/test/dummy/config.ru +1 -1
  26. data/test/dummy/config/abilities.rb +6 -7
  27. data/test/dummy/config/application.rb +3 -0
  28. data/test/dummy/config/database.yml +4 -22
  29. data/test/dummy/config/database.yml.travis +3 -0
  30. data/test/dummy/config/environments/development.rb +6 -2
  31. data/test/dummy/config/environments/production.rb +16 -24
  32. data/test/dummy/config/environments/test.rb +7 -12
  33. data/test/dummy/config/initializers/assets.rb +11 -0
  34. data/test/dummy/config/initializers/mime_types.rb +1 -1
  35. data/test/dummy/config/routes.rb +1 -54
  36. data/test/dummy/config/secrets.yml +3 -3
  37. data/test/dummy/db/migrate/20140629203344_create_users.rb +1 -3
  38. data/test/dummy/db/migrate/20140629203412_create_products.rb +7 -0
  39. data/test/dummy/db/schema.rb +9 -9
  40. data/test/dummy/log/development.log +78 -0
  41. data/test/dummy/log/test.log +1465 -246
  42. data/test/dummy/public/404.html +57 -63
  43. data/test/dummy/public/422.html +57 -63
  44. data/test/dummy/public/500.html +56 -62
  45. data/test/dummy/tmp/cache/assets/sprockets/v3.0/2b/2bzOr5XdBQAg_ZBDeXY157jGXLRL6qjEoFZBTPyLFwM.cache +0 -0
  46. data/test/dummy/tmp/cache/assets/sprockets/v3.0/48/48oV_bpl6OaHjWm9j-I1uNUp5m7SbkTgYjW6NaNnTfU.cache +0 -0
  47. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache +1 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache +1 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache +1 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v3.0/j0/j06P5zp022n2VUoAPi5fqCp_UbS7OaCD8XtVtEbHy58.cache +0 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache +1 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache +1 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache +0 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache +1 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x6/x6W7JXRDHOmqATQMRSTLu17o8EcA-ietA1qm_PMPjbo.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache +1 -0
  61. data/test/generator_test.rb +4 -4
  62. data/test/policy_test.rb +62 -0
  63. data/test/test_helper.rb +5 -16
  64. data/test/view_test.rb +6 -17
  65. metadata +63 -32
  66. data/lib/abilities/action_controller/base.rb +0 -20
  67. data/lib/abilities/action_view/base.rb +0 -14
  68. data/lib/abilities/concern.rb +0 -12
  69. data/lib/abilities/configuration.rb +0 -13
  70. data/lib/generators/abilities/install_generator.rb +0 -13
  71. data/test/changes_test.rb +0 -12
  72. data/test/checking_test.rb +0 -64
  73. data/test/controller_test.rb +0 -38
  74. data/test/dummy/README.rdoc +0 -28
  75. data/test/dummy/app/models/post.rb +0 -3
  76. data/test/dummy/config/initializers/abilities.rb +0 -7
  77. data/test/dummy/config/initializers/secret_token.rb +0 -1
  78. data/test/dummy/db/migrate/20140629203412_create_posts.rb +0 -10
@@ -1,38 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ControllerTest < ActiveSupport::TestCase
4
-
5
- test 'can helper' do
6
- assert controller.send(:can?, :create, post)
7
- end
8
-
9
- test 'cannot helper' do
10
- assert controller.send(:cannot?, :read, post)
11
- end
12
-
13
- test 'authorize helper' do
14
- assert_nothing_raised do
15
- controller.send :authorize!, :create, post
16
- end
17
- assert_raises Abilities::AccessDenied do
18
- controller.send :authorize!, :read, post
19
- end
20
- end
21
-
22
- private
23
-
24
- def controller
25
- @controller ||= ActionController::Base.new.tap do |controller|
26
- controller.class_eval do
27
- define_method :current_user do
28
- @user ||= User.new
29
- end
30
- end
31
- end
32
- end
33
-
34
- def post
35
- @post ||= Post.new
36
- end
37
-
38
- end
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
@@ -1,3 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- belongs_to :user
3
- end
@@ -1,7 +0,0 @@
1
- Abilities.configure do |config|
2
-
3
- config.fetcher do
4
- current_user
5
- end
6
-
7
- end
@@ -1 +0,0 @@
1
- Dummy::Application.config.secret_key_base = '2a5f2475b72242d6835656e2091073d9adcbf05f117ec0a952849e79bf364060ec77979a2d147e4c0a91ae2d6f306412aae345b2d9b30d2337496695fb8b8167'
@@ -1,10 +0,0 @@
1
- class CreatePosts < ActiveRecord::Migration
2
- def change
3
- create_table :posts do |t|
4
- t.text :content
5
- t.integer :user_id
6
-
7
- t.timestamps
8
- end
9
- end
10
- end