abilities 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +9 -9
  4. data/Rakefile +1 -1
  5. data/lib/abilities.rb +10 -1
  6. data/lib/abilities/action_controller/base.rb +2 -2
  7. data/lib/abilities/action_view/base.rb +2 -2
  8. data/lib/abilities/concern.rb +1 -1
  9. data/lib/abilities/configuration.rb +13 -0
  10. data/lib/abilities/definitions.rb +1 -1
  11. data/lib/abilities/exceptions.rb +1 -1
  12. data/lib/abilities/proxy.rb +1 -1
  13. data/lib/abilities/railtie.rb +1 -1
  14. data/lib/abilities/version.rb +2 -2
  15. data/lib/generators/abilities/install_generator.rb +1 -1
  16. data/lib/generators/abilities/templates/abilities.rb +1 -1
  17. data/test/changes_test.rb +1 -1
  18. data/test/checking_test.rb +1 -1
  19. data/test/controller_test.rb +1 -1
  20. data/test/dummy/README.rdoc +1 -1
  21. data/test/dummy/Rakefile +1 -1
  22. data/test/dummy/app/assets/javascripts/application.js +1 -1
  23. data/test/dummy/app/assets/stylesheets/application.css +1 -1
  24. data/test/dummy/app/controllers/application_controller.rb +1 -1
  25. data/test/dummy/app/helpers/application_helper.rb +1 -1
  26. data/test/dummy/app/models/post.rb +1 -1
  27. data/test/dummy/app/models/user.rb +1 -1
  28. data/test/dummy/app/views/layouts/application.html.erb +1 -1
  29. data/test/dummy/bin/bundle +1 -1
  30. data/test/dummy/bin/rails +1 -1
  31. data/test/dummy/bin/rake +1 -1
  32. data/test/dummy/config.ru +1 -1
  33. data/test/dummy/config/abilities.rb +1 -1
  34. data/test/dummy/config/application.rb +1 -1
  35. data/test/dummy/config/boot.rb +1 -1
  36. data/test/dummy/config/database.yml +1 -1
  37. data/test/dummy/config/environment.rb +1 -1
  38. data/test/dummy/config/environments/development.rb +1 -1
  39. data/test/dummy/config/environments/production.rb +1 -1
  40. data/test/dummy/config/environments/test.rb +1 -1
  41. data/test/dummy/config/initializers/abilities.rb +7 -0
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +1 -1
  43. data/test/dummy/config/initializers/cookies_serializer.rb +1 -1
  44. data/test/dummy/config/initializers/filter_parameter_logging.rb +1 -1
  45. data/test/dummy/config/initializers/inflections.rb +1 -1
  46. data/test/dummy/config/initializers/mime_types.rb +1 -1
  47. data/test/dummy/config/initializers/secret_token.rb +1 -1
  48. data/test/dummy/config/initializers/session_store.rb +1 -1
  49. data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
  50. data/test/dummy/config/locales/en.yml +1 -1
  51. data/test/dummy/config/routes.rb +1 -1
  52. data/test/dummy/config/secrets.yml +1 -1
  53. data/test/dummy/db/migrate/20140629203344_create_users.rb +1 -1
  54. data/test/dummy/db/migrate/20140629203412_create_posts.rb +1 -1
  55. data/test/dummy/db/schema.rb +1 -1
  56. data/test/dummy/log/test.log +246 -0
  57. data/test/dummy/public/404.html +1 -1
  58. data/test/dummy/public/422.html +1 -1
  59. data/test/dummy/public/500.html +1 -1
  60. data/test/generator_test.rb +1 -1
  61. data/test/test_helper.rb +1 -1
  62. data/test/view_test.rb +1 -1
  63. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daa4a9202f1a34ee77f510412c6ef2eb54e6fe17
4
- data.tar.gz: 3f0a7f5fcf0e7db439d8ac0bd8a86e17213ab36f
3
+ metadata.gz: 73ae248bbe708f9a398a788c4db88773f66bbf08
4
+ data.tar.gz: c59fcc7224d4493496754293d535d2e35e28a5b4
5
5
  SHA512:
6
- metadata.gz: 30519f7fc35372ec2970a98242ec90b9bff51e393992185e09770acc90509d749e255dab8abc43166f8038bb64fba7d21bd66ad4f6ed0865de56bc70e0f83e96
7
- data.tar.gz: 64bc4bf03f9ce9ce296a8ca70acc1377202a6022000ba0dd2a0a813cbffd17dd9905e83f87a384a503b32037199db9b2d719a75dc12b4143fa63bafa030a65e7
6
+ metadata.gz: ad7edc77a9356754a83df963fa96ff53fb677e89a3cbab259b68465973bbf581b594cf40c52fcd0edf663be587471816e3628943ec2940f94a50b7221f941687
7
+ data.tar.gz: 55d7a75da416b82320cb3fb36c5d8499ed478485d03baf4c5aab7ed74e06d0e34c37d66e42d1f4a083fdca262346a03712a2b2ea26f1409c85f92310da14f47a
data/MIT-LICENSE CHANGED
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/abilities.svg)](http://badge.fury.io/rb/abilities)
2
- [![Code Climate](https://codeclimate.com/github/mmontossi/abilities/badges/gpa.svg)](https://codeclimate.com/github/mmontossi/abilities) [![Build Status](https://travis-ci.org/mmontossi/abilities.svg)](https://travis-ci.org/mmontossi/abilities)
2
+ [![Code Climate](https://codeclimate.com/github/mmontossi/abilities/badges/gpa.svg)](https://codeclimate.com/github/mmontossi/abilities)
3
+ [![Build Status](https://travis-ci.org/mmontossi/abilities.svg)](https://travis-ci.org/mmontossi/abilities)
3
4
  [![Dependency Status](https://gemnasium.com/mmontossi/abilities.svg)](https://gemnasium.com/mmontossi/abilities)
4
5
 
5
6
  # Abilities
@@ -25,17 +26,16 @@ Generate the abilities configuration file:
25
26
  bundle exec rails g abilities:install
26
27
  ```
27
28
 
28
- Ensure there is a current_user helper available in your controllers and views:
29
+ Define the user fetcher for your controllers and views:
29
30
  ```ruby
30
- class ApplicationController < ActionController::Base
31
- helper :current_user
32
- def current_user
33
- @current_user ||= User.find_by(id: session[:user_id])
31
+ Abilities.configure do |config|
32
+ config.fetcher do
33
+ current_user
34
34
  end
35
35
  end
36
36
  ```
37
37
 
38
- Add the abilities concern to the model:
38
+ Add the abilities concern to the model if you want to call can? and cannot? in the user instance:
39
39
  ```ruby
40
40
  class User < ActiveRecord::Base
41
41
  include Abilities::Concern
@@ -68,7 +68,7 @@ Abilities.define do
68
68
  end
69
69
  ```
70
70
 
71
- NOTE: Any method besides can and cannot references the current_user.
71
+ NOTE: Any method besides can and cannot references the user instance.
72
72
 
73
73
  ### Checking
74
74
 
@@ -113,4 +113,4 @@ This gem is maintained and funded by [mmontossi](https://github.com/mmontossi).
113
113
 
114
114
  ## License
115
115
 
116
- It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
116
+ It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
data/Rakefile CHANGED
@@ -29,4 +29,4 @@ Rake::TestTask.new(:test) do |t|
29
29
  end
30
30
 
31
31
 
32
- task default: :test
32
+ task default: :test
data/lib/abilities.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'abilities/action_controller/base'
2
2
  require 'abilities/action_view/base'
3
3
  require 'abilities/proxy'
4
+ require 'abilities/configuration'
4
5
  require 'abilities/definitions'
5
6
  require 'abilities/exceptions'
6
7
  require 'abilities/concern'
@@ -9,6 +10,14 @@ require 'abilities/railtie'
9
10
  module Abilities
10
11
  class << self
11
12
 
13
+ def configure
14
+ yield configuration
15
+ end
16
+
17
+ def configuration
18
+ @configuration ||= Configuration.new
19
+ end
20
+
12
21
  def define(&block)
13
22
  @block = block
14
23
  end
@@ -22,4 +31,4 @@ module Abilities
22
31
  end
23
32
 
24
33
  end
25
- end
34
+ end
@@ -7,7 +7,7 @@ module Abilities
7
7
 
8
8
  %w(can? cannot?).each do |name|
9
9
  define_method name do |action, subject|
10
- Abilities.send name, current_user, action, subject
10
+ Abilities.send name, instance_exec(&Abilities.configuration.fetcher), action, subject
11
11
  end
12
12
  end
13
13
 
@@ -17,4 +17,4 @@ module Abilities
17
17
 
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -5,10 +5,10 @@ module Abilities
5
5
 
6
6
  %w(can? cannot?).each do |name|
7
7
  define_method name do |action, subject|
8
- Abilities.send name, current_user, action, subject
8
+ Abilities.send name, instance_exec(&Abilities.configuration.fetcher), action, subject
9
9
  end
10
10
  end
11
11
 
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -9,4 +9,4 @@ module Abilities
9
9
  end
10
10
 
11
11
  end
12
- end
12
+ end
@@ -0,0 +1,13 @@
1
+ module Abilities
2
+ class Configuration
3
+
4
+ def fetcher(&block)
5
+ if block_given?
6
+ @fetcher = block
7
+ else
8
+ @fetcher
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -56,4 +56,4 @@ module Abilities
56
56
  end
57
57
 
58
58
  end
59
- end
59
+ end
@@ -1,3 +1,3 @@
1
1
  module Abilities
2
2
  class AccessDenied < StandardError; end
3
- end
3
+ end
@@ -20,4 +20,4 @@ module Abilities
20
20
  end
21
21
 
22
22
  end
23
- end
23
+ end
@@ -11,4 +11,4 @@ module Abilities
11
11
  end
12
12
 
13
13
  end
14
- end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Abilities
2
2
 
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
 
5
- end
5
+ end
@@ -10,4 +10,4 @@ module Abilities
10
10
  end
11
11
 
12
12
  end
13
- end
13
+ end
@@ -1,2 +1,2 @@
1
1
  Abilities.define do
2
- end
2
+ end
data/test/changes_test.rb CHANGED
@@ -9,4 +9,4 @@ class ChangesTest < ActiveSupport::TestCase
9
9
  assert user.can?(:destroy, Post)
10
10
  end
11
11
 
12
- end
12
+ end
@@ -61,4 +61,4 @@ class CheckingTest < ActiveSupport::TestCase
61
61
  @admin_user ||= User.new(admin: true)
62
62
  end
63
63
 
64
- end
64
+ end
@@ -35,4 +35,4 @@ class ControllerTest < ActiveSupport::TestCase
35
35
  @post ||= Post.new
36
36
  end
37
37
 
38
- end
38
+ end
@@ -25,4 +25,4 @@ Things you may want to cover:
25
25
 
26
26
 
27
27
  Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
28
+ <tt>rake doc:app</tt>.
data/test/dummy/Rakefile CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  require File.expand_path('../config/application', __FILE__)
5
5
 
6
- Rails.application.load_tasks
6
+ Rails.application.load_tasks
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_tree .
@@ -12,4 +12,4 @@
12
12
  *
13
13
  *= require_tree .
14
14
  *= require_self
15
- */
15
+ */
@@ -2,4 +2,4 @@ class ApplicationController < ActionController::Base
2
2
  # Prevent CSRF attacks by raising an exception.
3
3
  # For APIs, you may want to use :null_session instead.
4
4
  protect_from_forgery with: :exception
5
- end
5
+ end
@@ -1,2 +1,2 @@
1
1
  module ApplicationHelper
2
- end
2
+ end
@@ -1,3 +1,3 @@
1
1
  class Post < ActiveRecord::Base
2
2
  belongs_to :user
3
- end
3
+ end
@@ -1,3 +1,3 @@
1
1
  class User < ActiveRecord::Base
2
2
  include Abilities::Concern
3
- end
3
+ end
@@ -11,4 +11,4 @@
11
11
  <%= yield %>
12
12
 
13
13
  </body>
14
- </html>
14
+ </html>
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
3
+ load Gem.bin_path('bundler', 'bundle')
data/test/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  APP_PATH = File.expand_path('../../config/application', __FILE__)
3
3
  require_relative '../config/boot'
4
- require 'rails/commands'
4
+ require 'rails/commands'
data/test/dummy/bin/rake CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative '../config/boot'
3
3
  require 'rake'
4
- Rake.application.run
4
+ Rake.application.run
data/test/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
3
  require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
4
+ run Rails.application
@@ -7,4 +7,4 @@ Abilities.define do
7
7
  end
8
8
  can :manage, User
9
9
  can :touch, :all
10
- end
10
+ end
@@ -19,4 +19,4 @@ module Dummy
19
19
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
20
  # config.i18n.default_locale = :de
21
21
  end
22
- end
22
+ end
@@ -2,4 +2,4 @@
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
4
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -22,4 +22,4 @@ test:
22
22
 
23
23
  production:
24
24
  <<: *default
25
- database: db/production.sqlite3
25
+ database: db/production.sqlite3
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
- Rails.application.initialize!
5
+ Rails.application.initialize!
@@ -34,4 +34,4 @@ Dummy::Application.configure do
34
34
 
35
35
  # Raises error for missing translations
36
36
  # config.action_view.raise_on_missing_translations = true
37
- end
37
+ end
@@ -84,4 +84,4 @@ Dummy::Application.configure do
84
84
 
85
85
  # Do not dump schema after migrations.
86
86
  config.active_record.dump_schema_after_migration = false
87
- end
87
+ end
@@ -44,4 +44,4 @@ Dummy::Application.configure do
44
44
  if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
45
45
  config.active_support.test_order = :random
46
46
  end
47
- end
47
+ end
@@ -0,0 +1,7 @@
1
+ Abilities.configure do |config|
2
+
3
+ config.fetcher do
4
+ current_user
5
+ end
6
+
7
+ end
@@ -4,4 +4,4 @@
4
4
  # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
5
 
6
6
  # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +1,4 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
4
+ Rails.application.config.filter_parameters += [:password]
@@ -13,4 +13,4 @@
13
13
  # These inflection rules are supported but not enabled by default:
14
14
  # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
15
  # inflect.acronym 'RESTful'
16
- # end
16
+ # end
@@ -1,4 +1,4 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -1 +1 @@
1
- Dummy::Application.config.secret_key_base = '2a5f2475b72242d6835656e2091073d9adcbf05f117ec0a952849e79bf364060ec77979a2d147e4c0a91ae2d6f306412aae345b2d9b30d2337496695fb8b8167'
1
+ Dummy::Application.config.secret_key_base = '2a5f2475b72242d6835656e2091073d9adcbf05f117ec0a952849e79bf364060ec77979a2d147e4c0a91ae2d6f306412aae345b2d9b30d2337496695fb8b8167'
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -11,4 +11,4 @@ end
11
11
  # To enable root element in JSON for ActiveRecord objects.
12
12
  # ActiveSupport.on_load(:active_record) do
13
13
  # self.include_root_in_json = true
14
- # end
14
+ # end
@@ -20,4 +20,4 @@
20
20
  # available at http://guides.rubyonrails.org/i18n.html.
21
21
 
22
22
  en:
23
- hello: "Hello world"
23
+ hello: "Hello world"
@@ -53,4 +53,4 @@ Rails.application.routes.draw do
53
53
  # # (app/controllers/admin/products_controller.rb)
54
54
  # resources :products
55
55
  # end
56
- end
56
+ end
@@ -19,4 +19,4 @@ test:
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
21
21
  production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -8,4 +8,4 @@ class CreateUsers < ActiveRecord::Migration
8
8
  t.timestamps
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -7,4 +7,4 @@ class CreatePosts < ActiveRecord::Migration
7
7
  t.timestamps
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -28,4 +28,4 @@ ActiveRecord::Schema.define(version: 20140629203412) do
28
28
  t.datetime "updated_at"
29
29
  end
30
30
 
31
- end
31
+ end
@@ -0,0 +1,246 @@
1
+  (0.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" text, "user_id" integer, "created_at" datetime, "updated_at" datetime) 
2
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email" varchar, "admin" boolean, "created_at" datetime, "updated_at" datetime)
3
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
4
+  (0.4ms) select sqlite_version(*)
5
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
+  (0.0ms) SELECT version FROM "schema_migrations"
7
+  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140629203412')
8
+  (0.1ms) begin transaction
9
+ -------------------------
10
+ ViewTest: test_can_helper
11
+ -------------------------
12
+  (0.0ms) rollback transaction
13
+  (0.0ms) begin transaction
14
+ ----------------------------
15
+ ViewTest: test_cannot_helper
16
+ ----------------------------
17
+  (0.0ms) rollback transaction
18
+  (0.1ms) begin transaction
19
+ ------------------------------------
20
+ CheckingTest: test_cannot_definition
21
+ ------------------------------------
22
+  (0.0ms) rollback transaction
23
+  (0.0ms) begin transaction
24
+ -------------------------------------
25
+ CheckingTest: test_ability_conditions
26
+ -------------------------------------
27
+  (0.0ms) rollback transaction
28
+  (0.0ms) begin transaction
29
+ ---------------------------------------
30
+ CheckingTest: test_undefined_definition
31
+ ---------------------------------------
32
+  (0.0ms) rollback transaction
33
+  (0.0ms) begin transaction
34
+ ------------------------------
35
+ CheckingTest: test_all_subject
36
+ ------------------------------
37
+  (0.0ms) rollback transaction
38
+  (0.0ms) begin transaction
39
+ -----------------------------------------------
40
+ CheckingTest: test_can_definition_with_instance
41
+ -----------------------------------------------
42
+  (0.0ms) rollback transaction
43
+  (0.0ms) begin transaction
44
+ --------------------------------
45
+ CheckingTest: test_manage_action
46
+ --------------------------------
47
+  (0.0ms) rollback transaction
48
+  (0.0ms) begin transaction
49
+ --------------------------------
50
+ CheckingTest: test_ability_block
51
+ --------------------------------
52
+  (0.1ms) rollback transaction
53
+  (0.0ms) begin transaction
54
+ --------------------------------------------
55
+ CheckingTest: test_can_definition_with_model
56
+ --------------------------------------------
57
+  (0.0ms) rollback transaction
58
+  (0.0ms) begin transaction
59
+ --------------------------------
60
+ ChangesTest: test_record_changes
61
+ --------------------------------
62
+  (0.0ms) rollback transaction
63
+  (0.0ms) begin transaction
64
+ -------------------------------------
65
+ ControllerTest: test_authorize_helper
66
+ -------------------------------------
67
+  (0.0ms) rollback transaction
68
+  (0.0ms) begin transaction
69
+ -------------------------------
70
+ ControllerTest: test_can_helper
71
+ -------------------------------
72
+  (0.0ms) rollback transaction
73
+  (0.0ms) begin transaction
74
+ ----------------------------------
75
+ ControllerTest: test_cannot_helper
76
+ ----------------------------------
77
+  (0.0ms) rollback transaction
78
+  (0.0ms) begin transaction
79
+ ------------------------------------------
80
+ GeneratorsTest: test_initializer_generator
81
+ ------------------------------------------
82
+  (0.1ms) rollback transaction
83
+  (0.2ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" text, "user_id" integer, "created_at" datetime, "updated_at" datetime) 
84
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email" varchar, "admin" boolean, "created_at" datetime, "updated_at" datetime)
85
+  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
86
+  (0.0ms) select sqlite_version(*)
87
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
88
+  (0.0ms) SELECT version FROM "schema_migrations"
89
+  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140629203412')
90
+  (0.1ms) begin transaction
91
+ -------------------------
92
+ ViewTest: test_can_helper
93
+ -------------------------
94
+  (0.1ms) rollback transaction
95
+  (0.0ms) begin transaction
96
+ ----------------------------
97
+ ViewTest: test_cannot_helper
98
+ ----------------------------
99
+  (0.0ms) rollback transaction
100
+  (0.0ms) begin transaction
101
+ -------------------------------------
102
+ ControllerTest: test_authorize_helper
103
+ -------------------------------------
104
+  (0.0ms) rollback transaction
105
+  (0.0ms) begin transaction
106
+ -------------------------------
107
+ ControllerTest: test_can_helper
108
+ -------------------------------
109
+  (0.0ms) rollback transaction
110
+  (0.0ms) begin transaction
111
+ ----------------------------------
112
+ ControllerTest: test_cannot_helper
113
+ ----------------------------------
114
+  (0.0ms) rollback transaction
115
+  (0.0ms) begin transaction
116
+ --------------------------------
117
+ ChangesTest: test_record_changes
118
+ --------------------------------
119
+  (0.0ms) rollback transaction
120
+  (0.0ms) begin transaction
121
+ ---------------------------------------
122
+ CheckingTest: test_undefined_definition
123
+ ---------------------------------------
124
+  (0.0ms) rollback transaction
125
+  (0.0ms) begin transaction
126
+ -------------------------------------
127
+ CheckingTest: test_ability_conditions
128
+ -------------------------------------
129
+  (0.0ms) rollback transaction
130
+  (0.0ms) begin transaction
131
+ ------------------------------
132
+ CheckingTest: test_all_subject
133
+ ------------------------------
134
+  (0.0ms) rollback transaction
135
+  (0.0ms) begin transaction
136
+ --------------------------------
137
+ CheckingTest: test_ability_block
138
+ --------------------------------
139
+  (0.0ms) rollback transaction
140
+  (0.0ms) begin transaction
141
+ --------------------------------
142
+ CheckingTest: test_manage_action
143
+ --------------------------------
144
+  (0.0ms) rollback transaction
145
+  (0.0ms) begin transaction
146
+ --------------------------------------------
147
+ CheckingTest: test_can_definition_with_model
148
+ --------------------------------------------
149
+  (0.0ms) rollback transaction
150
+  (0.0ms) begin transaction
151
+ ------------------------------------
152
+ CheckingTest: test_cannot_definition
153
+ ------------------------------------
154
+  (0.0ms) rollback transaction
155
+  (0.0ms) begin transaction
156
+ -----------------------------------------------
157
+ CheckingTest: test_can_definition_with_instance
158
+ -----------------------------------------------
159
+  (0.0ms) rollback transaction
160
+  (0.0ms) begin transaction
161
+ ------------------------------------------
162
+ GeneratorsTest: test_initializer_generator
163
+ ------------------------------------------
164
+  (0.1ms) rollback transaction
165
+  (0.2ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" text, "user_id" integer, "created_at" datetime, "updated_at" datetime) 
166
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email" varchar, "admin" boolean, "created_at" datetime, "updated_at" datetime)
167
+  (0.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
168
+  (0.1ms) select sqlite_version(*)
169
+  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
170
+  (0.0ms) SELECT version FROM "schema_migrations"
171
+  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140629203412')
172
+  (0.1ms) begin transaction
173
+ -------------------------
174
+ ViewTest: test_can_helper
175
+ -------------------------
176
+  (0.0ms) rollback transaction
177
+  (0.1ms) begin transaction
178
+ ----------------------------
179
+ ViewTest: test_cannot_helper
180
+ ----------------------------
181
+  (0.0ms) rollback transaction
182
+  (0.0ms) begin transaction
183
+ -----------------------------------------------
184
+ CheckingTest: test_can_definition_with_instance
185
+ -----------------------------------------------
186
+  (0.0ms) rollback transaction
187
+  (0.0ms) begin transaction
188
+ --------------------------------
189
+ CheckingTest: test_manage_action
190
+ --------------------------------
191
+  (0.0ms) rollback transaction
192
+  (0.1ms) begin transaction
193
+ ------------------------------------
194
+ CheckingTest: test_cannot_definition
195
+ ------------------------------------
196
+  (0.0ms) rollback transaction
197
+  (0.0ms) begin transaction
198
+ ---------------------------------------
199
+ CheckingTest: test_undefined_definition
200
+ ---------------------------------------
201
+  (0.0ms) rollback transaction
202
+  (0.0ms) begin transaction
203
+ --------------------------------------------
204
+ CheckingTest: test_can_definition_with_model
205
+ --------------------------------------------
206
+  (0.0ms) rollback transaction
207
+  (0.0ms) begin transaction
208
+ --------------------------------
209
+ CheckingTest: test_ability_block
210
+ --------------------------------
211
+  (0.0ms) rollback transaction
212
+  (0.0ms) begin transaction
213
+ -------------------------------------
214
+ CheckingTest: test_ability_conditions
215
+ -------------------------------------
216
+  (0.0ms) rollback transaction
217
+  (0.0ms) begin transaction
218
+ ------------------------------
219
+ CheckingTest: test_all_subject
220
+ ------------------------------
221
+  (0.0ms) rollback transaction
222
+  (0.0ms) begin transaction
223
+ --------------------------------
224
+ ChangesTest: test_record_changes
225
+ --------------------------------
226
+  (0.0ms) rollback transaction
227
+  (0.0ms) begin transaction
228
+ -------------------------------------
229
+ ControllerTest: test_authorize_helper
230
+ -------------------------------------
231
+  (0.0ms) rollback transaction
232
+  (0.0ms) begin transaction
233
+ -------------------------------
234
+ ControllerTest: test_can_helper
235
+ -------------------------------
236
+  (0.0ms) rollback transaction
237
+  (0.0ms) begin transaction
238
+ ----------------------------------
239
+ ControllerTest: test_cannot_helper
240
+ ----------------------------------
241
+  (0.1ms) rollback transaction
242
+  (0.0ms) begin transaction
243
+ ------------------------------------------
244
+ GeneratorsTest: test_initializer_generator
245
+ ------------------------------------------
246
+  (0.1ms) rollback transaction
@@ -64,4 +64,4 @@
64
64
  <p>If you are the application owner check the logs for more information.</p>
65
65
  </div>
66
66
  </body>
67
- </html>
67
+ </html>
@@ -64,4 +64,4 @@
64
64
  <p>If you are the application owner check the logs for more information.</p>
65
65
  </div>
66
66
  </body>
67
- </html>
67
+ </html>
@@ -63,4 +63,4 @@
63
63
  <p>If you are the application owner check the logs for more information.</p>
64
64
  </div>
65
65
  </body>
66
- </html>
66
+ </html>
@@ -15,4 +15,4 @@ class GeneratorsTest < Rails::Generators::TestCase
15
15
  assert_file 'config/abilities.rb'
16
16
  end
17
17
 
18
- end
18
+ end
data/test/test_helper.rb CHANGED
@@ -21,4 +21,4 @@ ActiveRecord::Base.establish_connection(config['test'])
21
21
  load(File.expand_path('../dummy/db/schema.rb', __FILE__))
22
22
 
23
23
  # Include helpers
24
- ActionView::TestCase.send :include, Abilities::ActionView::Base
24
+ ActionView::TestCase.send :include, Abilities::ActionView::Base
data/test/view_test.rb CHANGED
@@ -20,4 +20,4 @@ class ViewTest < ActionView::TestCase
20
20
  @user ||= User.new
21
21
  end
22
22
 
23
- end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmontossi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,6 +58,7 @@ files:
58
58
  - lib/abilities/action_controller/base.rb
59
59
  - lib/abilities/action_view/base.rb
60
60
  - lib/abilities/concern.rb
61
+ - lib/abilities/configuration.rb
61
62
  - lib/abilities/definitions.rb
62
63
  - lib/abilities/exceptions.rb
63
64
  - lib/abilities/proxy.rb
@@ -89,6 +90,7 @@ files:
89
90
  - test/dummy/config/environments/development.rb
90
91
  - test/dummy/config/environments/production.rb
91
92
  - test/dummy/config/environments/test.rb
93
+ - test/dummy/config/initializers/abilities.rb
92
94
  - test/dummy/config/initializers/backtrace_silencers.rb
93
95
  - test/dummy/config/initializers/cookies_serializer.rb
94
96
  - test/dummy/config/initializers/filter_parameter_logging.rb
@@ -103,6 +105,7 @@ files:
103
105
  - test/dummy/db/migrate/20140629203344_create_users.rb
104
106
  - test/dummy/db/migrate/20140629203412_create_posts.rb
105
107
  - test/dummy/db/schema.rb
108
+ - test/dummy/log/test.log
106
109
  - test/dummy/public/404.html
107
110
  - test/dummy/public/422.html
108
111
  - test/dummy/public/500.html
@@ -122,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
125
  requirements:
123
126
  - - ">="
124
127
  - !ruby/object:Gem::Version
125
- version: 1.9.3
128
+ version: 2.0.0
126
129
  required_rubygems_version: !ruby/object:Gem::Requirement
127
130
  requirements:
128
131
  - - ">="
@@ -130,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
133
  version: '0'
131
134
  requirements: []
132
135
  rubyforge_project:
133
- rubygems_version: 2.4.5
136
+ rubygems_version: 2.5.1
134
137
  signing_key:
135
138
  specification_version: 4
136
139
  summary: Abilities for rails.
@@ -156,6 +159,7 @@ test_files:
156
159
  - test/dummy/config/environments/development.rb
157
160
  - test/dummy/config/environments/production.rb
158
161
  - test/dummy/config/environments/test.rb
162
+ - test/dummy/config/initializers/abilities.rb
159
163
  - test/dummy/config/initializers/backtrace_silencers.rb
160
164
  - test/dummy/config/initializers/cookies_serializer.rb
161
165
  - test/dummy/config/initializers/filter_parameter_logging.rb
@@ -171,6 +175,7 @@ test_files:
171
175
  - test/dummy/db/migrate/20140629203344_create_users.rb
172
176
  - test/dummy/db/migrate/20140629203412_create_posts.rb
173
177
  - test/dummy/db/schema.rb
178
+ - test/dummy/log/test.log
174
179
  - test/dummy/public/404.html
175
180
  - test/dummy/public/422.html
176
181
  - test/dummy/public/500.html