can_can_dry 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/can_can_dry/version.rb +1 -1
- data/spec/lib/can_can_dry/path_recognizer_spec.rb +17 -0
- data/spec/lib/rubocop_check_spec.rb +7 -0
- data/spec/spec_helper.rb +100 -0
- metadata +13 -14
- data/Rakefile +0 -19
- data/test/can_can_dry_test.rb +0 -9
- data/test/lib/can_can_dry/path_recognizer_test.rb +0 -17
- data/test/test_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d616a9b6ad397897fac85697703891c64d112c1f35d1a0dccd1440d1ef104a
|
4
|
+
data.tar.gz: f0ee05bb9187e61f33137e0b3ae8b86c5a9b262ed02cbf31afd02587814afaec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0170885cc2ebe41ba704a6a47a3b9f4dc4e7281f2591defe4460981169abe4176f1f244041c41df44ec054eebb9af4775885cc1fbf62b6f2bcb546b7ffab667d'
|
7
|
+
data.tar.gz: 4845274bc917347ce95087f940d8e154ec928f5062a7e2f488d254406d581c220b30a13bc218ad914e85ad7b3e75fad3384f40a1c06d8adba91f1389d9f16d4a
|
data/lib/can_can_dry/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'can_can_dry/path_recognizer'
|
4
|
+
|
5
|
+
RSpec.describe ::CanCanDry::PathRecognizer do
|
6
|
+
describe '#remove_root_path' do
|
7
|
+
[%w[/path/to/action /prefix/ /prefix/path/to/action],
|
8
|
+
%w[/path/to/action /prefix /prefix/path/to/action],
|
9
|
+
%w[/path / /path],
|
10
|
+
['/path', '', '/path'],
|
11
|
+
%w[/unknown/path /abc /unknown/path]].each do |s|
|
12
|
+
it do
|
13
|
+
expect(described_class.send(:remove_root_path, s[1], s[2])).to eq(s[0])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
43
|
+
# have no way to turn it off -- the option exists only for backwards
|
44
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
45
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
46
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
47
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
# # This allows you to limit a spec run to individual examples or groups
|
52
|
+
# # you care about by tagging them with `:focus` metadata. When nothing
|
53
|
+
# # is tagged with `:focus`, all examples get run. RSpec also provides
|
54
|
+
# # aliases for `it`, `describe`, and `context` that include `:focus`
|
55
|
+
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
56
|
+
# config.filter_run_when_matching :focus
|
57
|
+
#
|
58
|
+
# # Allows RSpec to persist some state between runs in order to support
|
59
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
60
|
+
# # you configure your source control system to ignore this file.
|
61
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
62
|
+
#
|
63
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
64
|
+
# # recommended. For more details, see:
|
65
|
+
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
66
|
+
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
67
|
+
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
68
|
+
# config.disable_monkey_patching!
|
69
|
+
#
|
70
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
71
|
+
# # be too noisy due to issues in dependencies.
|
72
|
+
# config.warnings = true
|
73
|
+
#
|
74
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
75
|
+
# # file, and it's useful to allow more verbose output when running an
|
76
|
+
# # individual spec file.
|
77
|
+
# if config.files_to_run.one?
|
78
|
+
# # Use the documentation formatter for detailed output,
|
79
|
+
# # unless a formatter has already been configured
|
80
|
+
# # (e.g. via a command-line flag).
|
81
|
+
# config.default_formatter = "doc"
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# # Print the 10 slowest examples and example groups at the
|
85
|
+
# # end of the spec run, to help surface which specs are running
|
86
|
+
# # particularly slow.
|
87
|
+
# config.profile_examples = 10
|
88
|
+
#
|
89
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
90
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
91
|
+
# # the seed, which is printed after each run.
|
92
|
+
# # --seed 1234
|
93
|
+
# config.order = :random
|
94
|
+
#
|
95
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
96
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
97
|
+
# # test failures related to randomization by passing the same `--seed` value
|
98
|
+
# # as the one that triggered the failure.
|
99
|
+
# Kernel.srand config.seed
|
100
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: can_can_dry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cancancan
|
@@ -53,26 +53,25 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.2.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: eac_ruby_gem_support
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0.1'
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
74
74
|
files:
|
75
|
-
- Rakefile
|
76
75
|
- lib/can_can_dry.rb
|
77
76
|
- lib/can_can_dry/ability_mapping.rb
|
78
77
|
- lib/can_can_dry/ability_mapping/action_mapping_not_found.rb
|
@@ -87,9 +86,9 @@ files:
|
|
87
86
|
- lib/can_can_dry/railtie.rb
|
88
87
|
- lib/can_can_dry/version.rb
|
89
88
|
- lib/tasks/can_can_dry.rake
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
89
|
+
- spec/lib/can_can_dry/path_recognizer_spec.rb
|
90
|
+
- spec/lib/rubocop_check_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
93
92
|
homepage: https://github.com/esquilo-azul/can_can_dry
|
94
93
|
licenses: []
|
95
94
|
metadata:
|
@@ -115,6 +114,6 @@ signing_key:
|
|
115
114
|
specification_version: 4
|
116
115
|
summary: DRY authorization with CanCanCan.
|
117
116
|
test_files:
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
117
|
+
- spec/lib/can_can_dry/path_recognizer_spec.rb
|
118
|
+
- spec/lib/rubocop_check_spec.rb
|
119
|
+
- spec/spec_helper.rb
|
data/Rakefile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'bundler/setup'
|
5
|
-
rescue LoadError
|
6
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
-
end
|
8
|
-
|
9
|
-
Bundler::GemHelper.install_tasks
|
10
|
-
require 'rake/testtask'
|
11
|
-
|
12
|
-
Rake::TestTask.new(:test) do |t|
|
13
|
-
t.libs << 'lib'
|
14
|
-
t.libs << 'test'
|
15
|
-
t.pattern = 'test/**/*_test.rb'
|
16
|
-
t.verbose = false
|
17
|
-
end
|
18
|
-
|
19
|
-
task default: :test
|
data/test/can_can_dry_test.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module CanCanDry
|
6
|
-
class PathRecognizerTest < ActiveSupport::TestCase
|
7
|
-
test 'remove_root_path' do
|
8
|
-
[%w[/path/to/action /prefix/ /prefix/path/to/action],
|
9
|
-
%w[/path/to/action /prefix /prefix/path/to/action],
|
10
|
-
%w[/path / /path],
|
11
|
-
['/path', '', '/path'],
|
12
|
-
%w[/unknown/path /abc /unknown/path]].each do |s|
|
13
|
-
assert_equal s[0], ::CanCanDry::PathRecognizer.send(:remove_root_path, s[1], s[2]), s
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|