diff --git a/.rubocop.yml b/.rubocop.yml index 94327ab..fcca24f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ require: - rubocop-rspec +inherit_gem: + rspec-sleeping_king_studios: config/rubocop-rspec.yml + AllCops: TargetRubyVersion: 3.1 NewCops: enable @@ -35,35 +38,6 @@ RSpec: - '**/*_examples.rb' - '**/*_contract.rb' - '**/*_spec.rb' - Language: - ExampleGroups: - Regular: - - context - - describe - - wrap_context - Skipped: - - xcontext - - xdescribe - - xwrap_context - Focused: - - fcontext - - fdescribe - - fwrap_context - Helpers: - - let - - let! - - let? - Includes: - Examples: - - finclude_contract - - finclude_examples - - fwrap_examples - - include_contract - - include_examples - - wrap_examples - - xinclude_contract - - xinclude_examples - - xwrap_examples Layout/ArgumentAlignment: EnforcedStyle: with_fixed_indentation diff --git a/CHANGELOG.md b/CHANGELOG.md index b4b89f6..a90753a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ Updated minimum `Hashdiff` version to `~> 1.1`. +Extracted `rubocop-rspec` configuration. To add support for `RSpec::SleepingKingStudios` extensions to `rubocop-rspec`, add the following to your `.rubocop.yml` configuration file: + +```yml +inherit_gem: + rspec-sleeping_king_studios: 'config/rubocop-rspec.yml' +``` + ### Concerns #### Memoized Helpers diff --git a/README.md b/README.md index 4505a91..27300a1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,15 @@ A collection of matchers and extensions to ease TDD/BDD using RSpec. Extends bui ## About +### Setup + +To add support for `RSpec::SleepingKingStudios` extensions to `rubocop-rspec`, add the following to your `.rubocop.yml` configuration file: + +```yml +inherit_gem: + rspec-sleeping_king_studios: 'config/rubocop-rspec.yml' +``` + ### Compatibility RSpec::SleepingKingStudios is tested against the following dependencies: @@ -34,7 +43,6 @@ To contribute code, please fork the repository, make the desired updates, and th Please note that the `RSpec::SleepingKingStudios` project is released with a [Contributor Code of Conduct](https://github.com/sleepingkingstudios/rspec-sleeping_king_studios/blob/master/CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms. - ## Configuration RSpec::SleepingKingStudios now has configuration options available through `RSpec.configuration`. For example, to set the behavior of the matcher examples when a failure message expectation is undefined (see RSpec Matcher Examples, below), put the following in your `spec_helper` or other configuration file: diff --git a/config/rubocop-rspec.yml b/config/rubocop-rspec.yml new file mode 100644 index 0000000..7f54299 --- /dev/null +++ b/config/rubocop-rspec.yml @@ -0,0 +1,41 @@ +RSpec: + Language: + ExampleGroups: + Regular: + - context + - describe + - wrap_context + - wrap_deferred + Skipped: + - xcontext + - xdescribe + - xwrap_context + - xwrap_deferred + Focused: + - fcontext + - fdescribe + - fwrap_context + - fwrap_deferred + Helpers: + - let + - let! + - let? + Includes: + Examples: + - finclude_contract + - finclude_deferred + - finclude_examples + - fwrap_examples + - include_contract + - include_deferred + - include_examples + - wrap_examples + - xinclude_contract + - xinclude_deferred + - xinclude_examples + - xwrap_examples + SharedGroups: + Examples: + - deferred_examples + Context: + - deferred_context diff --git a/rspec-sleeping_king_studios.gemspec b/rspec-sleeping_king_studios.gemspec index ac20684..f40dc16 100644 --- a/rspec-sleeping_king_studios.gemspec +++ b/rspec-sleeping_king_studios.gemspec @@ -25,8 +25,9 @@ Gem::Specification.new do |gem| } gem.required_ruby_version = ['>= 3.1', '< 4.0'] - gem.require_path = 'lib' - gem.files = Dir['lib/**/*.rb', 'LICENSE', '*.md'] + gem.require_path = 'lib' + gem.files = + Dir['config/rubocop-rspec.yml', 'lib/**/*.rb', 'LICENSE', '*.md'] gem.add_dependency 'hashdiff', '~> 1.1' gem.add_dependency 'rspec', '~> 3.4'