diff --git a/CHANGELOG.md b/CHANGELOG.md index aa7defd..cb42e98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master +- Add support for RSpec aliases detection when linting policy specs with `rubocop-rspec` 2.0 ([@pirj][]) + ## 0.5.0 (2020-09-29) - Move `deny!` / `allow!` to core. ([@palkan][]) @@ -429,3 +431,4 @@ This value is now stored in a cache (if any) instead of just the call result (`t [@nicolas-brousse]: https://github.com/nicolas-brousse [@somenugget]: https://github.com/somenugget [@Be-ngt-oH]: https://github.com/Be-ngt-oH +[@pirj]: https://github.com/pirj diff --git a/action_policy.gemspec b/action_policy.gemspec index 2ad703b..ffb91d5 100644 --- a/action_policy.gemspec +++ b/action_policy.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/palkan/action_policy" spec.license = "MIT" - spec.files = Dir.glob("lib/**/*") + Dir.glob("lib/.rbnext/**/*") + %w[README.md LICENSE.txt CHANGELOG.md] + spec.files = Dir.glob("lib/**/*") + Dir.glob("lib/.rbnext/**/*") + %w[README.md LICENSE.txt CHANGELOG.md] + %w[config/rubocop-rspec.yml] spec.metadata = { "bug_tracker_uri" => "http://github.com/palkan/action_policy/issues", diff --git a/config/rubocop-rspec.yml b/config/rubocop-rspec.yml new file mode 100644 index 0000000..c3f664f --- /dev/null +++ b/config/rubocop-rspec.yml @@ -0,0 +1,17 @@ +RSpec: + Language: + ExampleGroups: + Regular: + - describe_rule + Focused: + - fdescribe_rule + Skipped: + - xdescribe_rule + Includes: + Examples: + - succeed + - failed + - fsucceed + - ffailed + - xsucceed + - xfailed diff --git a/docs/testing.md b/docs/testing.md index bc27c15..1580130 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -388,3 +388,13 @@ describe "users/index.html.slim" do end end ``` + +## Linting with RuboCop RSpec + +When you lint your RSpec spec files with `rubocop-rspec`, it will fail to detect RSpec aliases that Action Policy defines. +Make sure to use `rubocop-rspec` 2.0 or newer and add the following to your `.rubocop.yml`: + +```yaml +inherit_gem: + action_policy: config/rubocop-rspec.yml +```