corral_acl 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -1
- data/Gemfile +12 -1
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +34 -0
- data/bin/test +9 -0
- data/corral.gemspec +12 -12
- data/lib/corral/version.rb +1 -1
- data/lib/tasks/corral_tasks.rake +4 -0
- data/test/corral_test.rb +7 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +15 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/test_helper.rb +20 -0
- metadata +90 -51
- data/.rspec +0 -2
- data/doc/Ability.html +0 -257
- data/doc/Corral.html +0 -131
- data/doc/Corral/Ability.html +0 -802
- data/doc/Corral/AccessDenied.html +0 -146
- data/doc/Corral/AuthorizationNotPerformed.html +0 -145
- data/doc/Corral/ControllerAdditions.html +0 -513
- data/doc/Corral/ControllerAdditions/ClassMethods.html +0 -277
- data/doc/Corral/Error.html +0 -141
- data/doc/Corral/Generators.html +0 -117
- data/doc/Corral/Generators/AbilityGenerator.html +0 -195
- data/doc/Corral/NullRule.html +0 -226
- data/doc/Corral/SubjectRule.html +0 -406
- data/doc/_index.html +0 -194
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -474
- data/doc/doc/_index.html +0 -87
- data/doc/doc/class_list.html +0 -51
- data/doc/doc/css/common.css +0 -1
- data/doc/doc/css/full_list.css +0 -58
- data/doc/doc/css/style.css +0 -474
- data/doc/doc/file_list.html +0 -51
- data/doc/doc/frames.html +0 -17
- data/doc/doc/index.html +0 -87
- data/doc/doc/js/app.js +0 -243
- data/doc/doc/js/full_list.js +0 -216
- data/doc/doc/js/jquery.js +0 -4
- data/doc/doc/method_list.html +0 -51
- data/doc/doc/top-level-namespace.html +0 -102
- data/doc/file.README.html +0 -82
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -82
- data/doc/js/app.js +0 -243
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -211
- data/doc/top-level-namespace.html +0 -114
- data/spec/corral/ability_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -97
data/spec/corral/ability_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Corral::Ability do
|
4
|
-
before :each do
|
5
|
-
(@ability = double).extend Corral::Ability
|
6
|
-
end
|
7
|
-
|
8
|
-
it "is able to do anything" do
|
9
|
-
@ability.allow_anything!
|
10
|
-
expect(@ability.can?(:manage, String)).to be true
|
11
|
-
expect(@ability.cannot?(:manage, String)).to be false
|
12
|
-
end
|
13
|
-
|
14
|
-
it "is able to perform a specific action on everything" do
|
15
|
-
@ability.can(:read, :all)
|
16
|
-
expect(@ability.can?(:read, String)).to be true
|
17
|
-
expect(@ability.can?(:write, String)).to be false
|
18
|
-
end
|
19
|
-
|
20
|
-
it "cannot do something it has been told it cannot do" do
|
21
|
-
@ability.can(:read, :all)
|
22
|
-
expect(@ability.can?(:read, :this)).to be true
|
23
|
-
@ability.cannot(:read, :this)
|
24
|
-
expect(@ability.can?(:read, :this)).to be false
|
25
|
-
end
|
26
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'corral'
|
2
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
3
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
5
|
-
# this file to always be loaded, without a need to explicitly require it in any
|
6
|
-
# files.
|
7
|
-
#
|
8
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
9
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
10
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
11
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
12
|
-
# a separate helper file that requires the additional dependencies and performs
|
13
|
-
# the additional setup, and require it from the spec files that actually need
|
14
|
-
# it.
|
15
|
-
#
|
16
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
17
|
-
# users commonly want.
|
18
|
-
#
|
19
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
20
|
-
RSpec.configure do |config|
|
21
|
-
# rspec-expectations config goes here. You can use an alternate
|
22
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
23
|
-
# assertions if you prefer.
|
24
|
-
config.expect_with :rspec do |expectations|
|
25
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
26
|
-
# and `failure_message` of custom matchers include text for helper methods
|
27
|
-
# defined using `chain`, e.g.:
|
28
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
29
|
-
# # => "be bigger than 2 and smaller than 4"
|
30
|
-
# ...rather than:
|
31
|
-
# # => "be bigger than 2"
|
32
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
33
|
-
end
|
34
|
-
|
35
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
36
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
37
|
-
config.mock_with :rspec do |mocks|
|
38
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
39
|
-
# a real object. This is generally recommended, and will default to
|
40
|
-
# `true` in RSpec 4.
|
41
|
-
mocks.verify_partial_doubles = true
|
42
|
-
end
|
43
|
-
|
44
|
-
# The settings below are suggested to provide a good initial experience
|
45
|
-
# with RSpec, but feel free to customize to your heart's content.
|
46
|
-
=begin
|
47
|
-
# These two settings work together to allow you to limit a spec run
|
48
|
-
# to individual examples or groups you care about by tagging them with
|
49
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
50
|
-
# get run.
|
51
|
-
config.filter_run :focus
|
52
|
-
config.run_all_when_everything_filtered = true
|
53
|
-
|
54
|
-
# Allows RSpec to persist some state between runs in order to support
|
55
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
56
|
-
# you configure your source control system to ignore this file.
|
57
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
58
|
-
|
59
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
60
|
-
# recommended. For more details, see:
|
61
|
-
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
62
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
63
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
64
|
-
config.disable_monkey_patching!
|
65
|
-
|
66
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
67
|
-
# be too noisy due to issues in dependencies.
|
68
|
-
config.warnings = true
|
69
|
-
|
70
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
71
|
-
# file, and it's useful to allow more verbose output when running an
|
72
|
-
# individual spec file.
|
73
|
-
if config.files_to_run.one?
|
74
|
-
# Use the documentation formatter for detailed output,
|
75
|
-
# unless a formatter has already been configured
|
76
|
-
# (e.g. via a command-line flag).
|
77
|
-
config.default_formatter = 'doc'
|
78
|
-
end
|
79
|
-
|
80
|
-
# Print the 10 slowest examples and example groups at the
|
81
|
-
# end of the spec run, to help surface which specs are running
|
82
|
-
# particularly slow.
|
83
|
-
config.profile_examples = 10
|
84
|
-
|
85
|
-
# Run specs in random order to surface order dependencies. If you find an
|
86
|
-
# order dependency and want to debug it, you can fix the order by providing
|
87
|
-
# the seed, which is printed after each run.
|
88
|
-
# --seed 1234
|
89
|
-
config.order = :random
|
90
|
-
|
91
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
92
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
93
|
-
# test failures related to randomization by passing the same `--seed` value
|
94
|
-
# as the one that triggered the failure.
|
95
|
-
Kernel.srand config.seed
|
96
|
-
=end
|
97
|
-
end
|