diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ece068ce..fbd88ee9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: fail-fast: false matrix: ruby: + - 3.0.6 - 2.7.7 appraisal: - rails_6_1 diff --git a/.rubocop.yml b/.rubocop.yml index db51c335..30a93f9c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,17 +1,49 @@ inherit_from: .rubocop_todo.yml +require: + - rubocop-packaging + - rubocop-rails AllCops: + NewCops: disable TargetRubyVersion: 2.7 Exclude: - - '*.gemspec' -Layout/AlignParameters: + - 'gemfiles/*' +Bundler/OrderedGems: + Include: + - '**/Gemfile' +Layout/ArgumentAlignment: EnforcedStyle: with_fixed_indentation +Layout/CommentIndentation: + Enabled: false Layout/ConditionPosition: Enabled: false Layout/DotPosition: EnforcedStyle: trailing +Layout/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true +Layout/HeredocIndentation: + Enabled: false +Layout/LineLength: + Exclude: + - spec/**/* + AllowedPatterns: + - !ruby/regexp /\A +(it|describe|context|shared_examples|include_examples|it_behaves_like) ["']/ + - !ruby/regexp /\A(require|require_relative) ["']/ + - '^[ ]*#.+$' + - '^[ ]*''.+?'' => ''.+?'',?$' + - '^[ ]*".+?" => ".+?",?$' + Max: 100 Layout/MultilineMethodCallIndentation: EnforcedStyle: indented +Layout/ParameterAlignment: + EnforcedStyle: with_fixed_indentation +Layout/SpaceInLambdaLiteral: + EnforcedStyle: require_space +Layout/SpaceInsideBlockBraces: + Enabled: false +Lint/AmbiguousBlockAssociation: + Exclude: + - spec/**/* Lint/AmbiguousOperator: Enabled: false Lint/AmbiguousRegexpLiteral: @@ -22,58 +54,73 @@ Lint/DeprecatedClassMethods: Enabled: false Lint/ElseLayout: Enabled: false -Lint/HandleExceptions: - Enabled: false -Lint/IndentHeredoc: +Lint/FlipFlop: Enabled: false Lint/LiteralInInterpolation: Enabled: false Lint/Loop: Enabled: false +Lint/MissingSuper: + Enabled: false Lint/ParenthesesAsGroupedExpression: Enabled: false Lint/RequireParentheses: Enabled: false +Lint/SafeNavigationChain: + Enabled: false +Lint/SuppressedException: + Enabled: false Lint/UnderscorePrefixedVariableName: Enabled: false Lint/Void: Enabled: false +Metrics/AbcSize: + Enabled: false Metrics/BlockLength: Enabled: false Metrics/ClassLength: Enabled: false -Metrics/LineLength: - IgnoredPatterns: - - "^[ ]*describe.+$" - - "^[ ]*context.+$" - - "^[ ]*shared_context.+$" - - "^[ ]*shared_examples_for.+$" - - "^[ ]*it.+$" - - "^[ ]*'.+?' => '.+?',?$" - - "^[ ]*\".+?\" => \".+?\",?$" - - "^[ ]*.+?: .+?$" +Metrics/CyclomaticComplexity: + Enabled: false Metrics/MethodLength: Max: 30 +Metrics/ModuleLength: + Enabled: true + Exclude: + - spec/**/* +Metrics/ParameterLists: + CountKeywordArgs: false +Metrics/PerceivedComplexity: + Enabled: false Naming/AccessorMethodName: Enabled: false Naming/AsciiIdentifiers: Enabled: false Naming/BinaryOperatorParameterName: Enabled: false +Naming/FileName: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false Naming/MemoizedInstanceVariableName: EnforcedStyleForLeadingUnderscores: required -Style/ClassVars: +Naming/PredicateName: Enabled: false -Style/ColonMethodCall: +Naming/VariableNumber: Enabled: false -Naming/FileName: +Naming/RescuedExceptionsVariableName: + Enabled: false +Rails/Date: Enabled: false -Rails: - Enabled: true Rails/Delegate: Enabled: false Rails/HttpPositionalArguments: Enabled: false +Rails/SkipsModelValidations: + Exclude: + - spec/**/* +Rails/TimeZone: + Enabled: false Style/Alias: Enabled: false Style/ArrayJoin: @@ -82,18 +129,25 @@ Style/AsciiComments: Enabled: false Style/Attr: Enabled: false +Style/BlockDelimiters: + Enabled: false Style/CaseEquality: Enabled: false Style/CharacterLiteral: Enabled: false Style/ClassAndModuleChildren: Enabled: false +Style/ClassVars: + Enabled: false Style/CollectionMethods: + Enabled: true PreferredMethods: - find: detect - reduce: inject collect: map + find: detect find_all: select + reduce: inject +Style/ColonMethodCall: + Enabled: false Style/CommentAnnotation: Enabled: false Style/Documentation: @@ -102,18 +156,20 @@ Style/DoubleNegation: Enabled: false Style/EachWithObject: Enabled: false +Style/EmptyElse: + Enabled: false Style/EmptyLiteral: Enabled: false +Style/EmptyMethod: + EnforcedStyle: expanded Style/Encoding: Enabled: false Style/EvenOdd: Enabled: false -Style/ExpandPathArguments: - Enabled: false -Style/FlipFlop: - Enabled: false Style/FormatString: Enabled: false +Style/FormatStringToken: + EnforcedStyle: template Style/FrozenStringLiteralComment: Enabled: false Style/GlobalVars: @@ -126,6 +182,8 @@ Style/IfWithSemicolon: Enabled: false Style/InlineComment: Enabled: false +Style/InverseMethods: + Enabled: false Style/Lambda: Enabled: false Style/LambdaCall: @@ -152,6 +210,10 @@ Style/NumericPredicate: Enabled: false Style/OneLineConditional: Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/ParenthesesAroundCondition: + Enabled: false Style/PercentLiteralDelimiters: Enabled: false Style/PerlBackrefs: @@ -164,8 +226,6 @@ Style/RaiseArgs: Enabled: false Style/RegexpLiteral: Enabled: false -Style/RescueStandardError: - Enabled: false Style/SelfAssignment: Enabled: false Style/SignalException: @@ -177,16 +237,22 @@ Style/SingleLineMethods: Style/SpecialGlobalVars: Enabled: false Style/StringLiterals: - EnforcedStyle: double_quotes + EnforcedStyle: single_quotes Style/SymbolArray: Enabled: false +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma Style/TrivialAccessors: Enabled: false +Style/VariableInterpolation: + Enabled: false Style/WhenThen: Enabled: false Style/WhileUntilModifier: Enabled: false Style/WordArray: Enabled: false -Style/VariableInterpolation: - Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 717e9cb8..67ad9c96 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,39 +1,27 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-02-26 11:25:39 -0300 using RuboCop version 0.71.0. +# on 2023-07-23 17:08:33 UTC using RuboCop version 1.54.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 39 -# Cop supports --auto-correct. -# Configuration parameters: TreatCommentsAsGroupSeparators, Include. -# Include: **/*.gemfile, **/Gemfile, **/gems.rb -Bundler/OrderedGems: - Exclude: - - 'gemfiles/rails_4_2.gemfile' - - 'gemfiles/rails_5_0.gemfile' - - 'gemfiles/rails_5_1.gemfile' - - 'gemfiles/rails_5_2.gemfile' - - 'gemfiles/rails_6_0.gemfile' - # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/AlignArguments: +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: Exclude: - - 'test/shoulda/test_framework_detection_test.rb' + - 'shoulda-context.gemspec' -# Offense count: 1 -# Cop supports --auto-correct. +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). Layout/EmptyLineAfterGuardClause: Exclude: - 'lib/shoulda/context/context.rb' + - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' # Offense count: 5 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: empty_lines, no_empty_lines Layout/EmptyLinesAroundBlockBody: @@ -41,7 +29,7 @@ Layout/EmptyLinesAroundBlockBody: - 'test/shoulda/context_test.rb' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only Layout/EmptyLinesAroundClassBody: @@ -49,14 +37,21 @@ Layout/EmptyLinesAroundClassBody: - 'test/shoulda/context_test.rb' # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +Layout/LeadingCommentSpace: Exclude: - - 'Appraisals' + - 'lib/shoulda/context/proc_extensions.rb' + +# Offense count: 9 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 155 # Offense count: 4 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Layout/SpaceAfterComma: Exclude: - 'lib/shoulda/context/assertions.rb' @@ -64,13 +59,13 @@ Layout/SpaceAfterComma: - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Layout/SpaceAfterNot: Exclude: - 'test/shoulda/should_test.rb' # Offense count: 2 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. # SupportedStyles: space, no_space # SupportedStylesForEmptyBraces: space, no_space @@ -78,41 +73,26 @@ Layout/SpaceBeforeBlockBraces: Exclude: - 'lib/shoulda/context/autoload_macros.rb' -# Offense count: 16 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideBlockBraces: - Exclude: - - 'exe/convert_to_should_syntax' - - 'lib/shoulda/context/assertions.rb' - - 'lib/shoulda/context/autoload_macros.rb' - - 'lib/shoulda/context/tasks/list_tests.rake' - - 'test/shoulda/convert_to_should_syntax_test.rb' - - 'test/shoulda/helpers_test.rb' - - 'test/shoulda/should_test.rb' - # Offense count: 8 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space +# SupportedStyles: space, compact, no_space Layout/SpaceInsideParens: Exclude: - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' # Offense count: 3 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: final_newline, final_blank_line -Layout/TrailingBlankLines: +Layout/TrailingEmptyLines: Exclude: - 'lib/shoulda/context/context.rb' - 'test/fake_rails_root/test/shoulda_macros/custom_macro.rb' - 'test/shoulda/autoload_macro_test.rb' # Offense count: 4 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. Lint/UnusedBlockArgument: Exclude: @@ -120,36 +100,28 @@ Lint/UnusedBlockArgument: - 'test/shoulda/context_test.rb' # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. Lint/UnusedMethodArgument: Exclude: - 'lib/shoulda/context/dsl.rb' # Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessAssignment: Exclude: - 'lib/shoulda/context/context.rb' -# Offense count: 4 -Metrics/AbcSize: - Max: 22 - # Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: lowercase, uppercase Naming/HeredocDelimiterCase: Exclude: - 'lib/shoulda/context/context.rb' -# Offense count: 2 -# Configuration parameters: Blacklist. -# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) -Naming/HeredocDelimiterNaming: - Exclude: - - 'test/shoulda/convert_to_should_syntax_test.rb' - # Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyleForLeadingUnderscores. # SupportedStylesForLeadingUnderscores: disallowed, required, optional Naming/MemoizedInstanceVariableName: @@ -158,22 +130,26 @@ Naming/MemoizedInstanceVariableName: - 'lib/shoulda/context/dsl.rb' - 'lib/shoulda/context/world.rb' -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: PreferredName. -Naming/RescuedExceptionsVariableName: - Exclude: - - 'test/shoulda/helpers_test.rb' - # Offense count: 4 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: io, id, to, by, on, in, at, ip, db -Naming/UncommunicativeMethodParamName: +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: Exclude: - 'lib/shoulda/context/assertions.rb' +# Offense count: 1 +Packaging/GemspecGit: + Exclude: + - 'shoulda-context.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Packaging/RequireRelativeHardcodingLib: + Exclude: + - 'test/test_helper.rb' + # Offense count: 3 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Include. # Include: **/test/**/* Rails/AssertNot: @@ -182,6 +158,7 @@ Rails/AssertNot: - 'test/shoulda/should_test.rb' # Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb Rails/Output: @@ -189,55 +166,49 @@ Rails/Output: - 'lib/shoulda/context/context.rb' # Offense count: 2 -# Cop supports --auto-correct. +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. +# Include: **/Rakefile, **/*.rake +Rails/RakeEnvironment: + Exclude: + - 'lib/shoulda/context/tasks/list_tests.rake' + - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, Include. +# SupportedStyles: assert_not, refute # Include: **/test/**/* Rails/RefuteMethods: Exclude: - 'test/shoulda/helpers_test.rb' -# Offense count: 1 -# Cop supports --auto-correct. +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. -# SupportedStyles: strict, flexible -Rails/TimeZone: +# SupportedStyles: separated, grouped +Style/AccessorGrouping: Exclude: - - 'lib/shoulda/context/proc_extensions.rb' + - 'lib/shoulda/context/context.rb' # Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, conditionals -Style/AndOr: - Exclude: - - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' - -# Offense count: 20 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners. -# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces -# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object -# FunctionalMethods: let, let!, subject, watch -# IgnoredMethods: lambda, proc, it -Style/BlockDelimiters: +# This cop supports safe autocorrection (--autocorrect). +Style/EvalWithLocation: Exclude: - 'lib/shoulda/context/context.rb' - - 'test/shoulda/should_test.rb' -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/ExpandPathArguments: Exclude: - - 'test/fake_rails_root/test/shoulda_macros/custom_macro.rb' - - 'test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb' - - 'test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb' + - 'bin/supported_ruby_versions' + - 'test/test_helper.rb' # Offense count: 20 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent Style/HashSyntax: Exclude: - 'lib/shoulda/context/context.rb' @@ -245,18 +216,13 @@ Style/HashSyntax: - 'test/shoulda/helpers_test.rb' - 'test/shoulda/should_test.rb' -# Offense count: 1 -Style/MethodMissingSuper: - Exclude: - - 'lib/shoulda/context/context.rb' - # Offense count: 1 Style/MissingRespondToMissing: Exclude: - 'lib/shoulda/context/context.rb' # Offense count: 3 -# Cop supports --auto-correct. +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: literals, strict Style/MutableConstant: @@ -264,21 +230,21 @@ Style/MutableConstant: - 'test/shoulda/convert_to_should_syntax_test.rb' # Offense count: 2 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Style/ParallelAssignment: Exclude: - 'lib/shoulda/context/proc_extensions.rb' - 'test/shoulda/should_test.rb' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleReturnValues. Style/RedundantReturn: Exclude: - 'lib/shoulda/context/context.rb' # Offense count: 18 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Style/RedundantSelf: Exclude: - 'lib/shoulda/context/context.rb' @@ -287,52 +253,67 @@ Style/RedundantSelf: - 'test/shoulda/should_test.rb' # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. -# Whitelist: present?, blank?, presence, try, try! +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! Style/SafeNavigation: Exclude: - 'lib/shoulda/context/dsl.rb' # Offense count: 2 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowAsExpressionSeparator. Style/Semicolon: Exclude: - 'lib/shoulda/context/assertions.rb' -# Offense count: 70 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: +# Offense count: 9 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: Exclude: - - 'Appraisals' - - 'bin/supported_ruby_versions' - - 'exe/convert_to_should_syntax' - - 'lib/shoulda/context/autoload_macros.rb' - 'lib/shoulda/context/context.rb' - - 'lib/shoulda/context/dsl.rb' - - 'lib/shoulda/context/tasks.rb' - 'lib/shoulda/context/tasks/list_tests.rake' - 'lib/shoulda/context/tasks/yaml_to_shoulda.rake' - - 'test/shoulda/autoload_macro_test.rb' - - 'test/shoulda/context_test.rb' - - 'test/shoulda/convert_to_should_syntax_test.rb' - - 'test/shoulda/helpers_test.rb' - 'test/shoulda/should_test.rb' +# Offense count: 474 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: IgnoredMethods. -# IgnoredMethods: respond_to, define_method +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. +# AllowedMethods: define_method, mail, respond_to Style/SymbolProc: Exclude: - 'lib/shoulda/context/context.rb' -# Offense count: 55 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 155 +# Offense count: 26 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'lib/shoulda/context/context.rb' + - 'lib/shoulda/context/railtie.rb' + - 'test/shoulda/context_test.rb' + - 'test/shoulda/helpers_test.rb' + - 'test/shoulda/railtie_test.rb' + - 'test/shoulda/rerun_snippet_test.rb' + - 'test/shoulda/should_test.rb' + - 'test/shoulda/test_framework_detection_test.rb' + - 'test/test_helper.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'lib/shoulda/context/context.rb' + - 'lib/shoulda/context/test_framework_detection.rb' + - 'shoulda-context.gemspec' diff --git a/.ruby-version b/.ruby-version index 1f7da99d..818bd47a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.7 +3.0.6 diff --git a/Appraisals b/Appraisals index d7d134ee..e9c54f19 100644 --- a/Appraisals +++ b/Appraisals @@ -33,7 +33,7 @@ appraise "rails_6_0" do gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "bootsnap", ">= 1.4.2", require: false - gem "listen", ">= 3.0.5", "< 3.2" + gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "capybara", ">= 2.15" gem "selenium-webdriver" @@ -55,7 +55,7 @@ appraise "rails_6_1" do gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "bootsnap", ">= 1.4.2", require: false - gem "listen", ">= 3.0.5", "< 3.2" + gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "capybara", ">= 2.15" gem "selenium-webdriver" diff --git a/Gemfile b/Gemfile index 8a8e93c7..3768351d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gemspec gem "appraisal" -gem "bundler", "~> 1.0" +gem "bundler", "~> 2.0" gem "byebug" gem "m" gem "minitest" @@ -11,7 +11,9 @@ gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" -gem "rubocop", "0.71.0" +gem "rubocop", require: false +gem 'rubocop-packaging', require: false +gem 'rubocop-rails', require: false gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" diff --git a/Gemfile.lock b/Gemfile.lock index d2d8199e..3463e4c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,23 +6,33 @@ PATH GEM remote: https://rubygems.org/ specs: + activesupport (7.0.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) appraisal (2.2.0) bundler rake thor (>= 0.14.0) - ast (2.4.0) + ast (2.4.2) byebug (10.0.2) coderay (1.1.2) - jaro_winkler (1.5.4) + concurrent-ruby (1.2.2) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.6.3) + language_server-protocol (3.17.0.3) m (1.5.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) method_source (0.9.2) - minitest (5.14.0) + minitest (5.18.1) mocha (1.11.2) - parallel (1.19.1) - parser (2.7.1.0) - ast (~> 2.4.0) + parallel (1.23.0) + parser (3.2.2.3) + ast (~> 2.4.1) + racc power_assert (1.1.7) pry (0.12.2) coderay (~> 1.1.0) @@ -30,21 +40,39 @@ GEM pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) - rainbow (3.0.0) + racc (1.7.1) + rack (3.0.8) + rainbow (3.1.1) rake (13.0.1) - rubocop (0.71.0) - jaro_winkler (~> 1.5.1) + regexp_parser (2.8.1) + rexml (3.2.5) + rubocop (1.54.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.10.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-rails (2.20.2) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + ruby-progressbar (1.13.0) snowglobe (0.3.0) test-unit (3.3.5) power_assert thor (1.0.1) - unicode-display_width (1.6.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.4.2) warnings_logger (0.1.1) PLATFORMS @@ -52,7 +80,7 @@ PLATFORMS DEPENDENCIES appraisal - bundler (~> 1.0) + bundler (~> 2.0) byebug m minitest @@ -60,11 +88,13 @@ DEPENDENCIES pry (~> 0.12.0) pry-byebug (~> 3.6.0) rake - rubocop (= 0.71.0) + rubocop + rubocop-packaging + rubocop-rails shoulda-context! snowglobe (>= 0.3.0) test-unit warnings_logger BUNDLED WITH - 1.17.3 + 2.2.33 diff --git a/exe/convert_to_should_syntax b/exe/convert_to_should_syntax index ebdda984..e69a6103 100755 --- a/exe/convert_to_should_syntax +++ b/exe/convert_to_should_syntax @@ -21,13 +21,18 @@ def usage(msg = nil) puts " ..." puts " end" puts - puts "A copy of the old file will be left under #{TMP} in case\nthis script just seriously screws up" + puts "A copy of the old file will be left under #{TMP} in case" + puts "this script just seriously screws up" puts exit (msg ? 2 : 0) end usage("Wrong number of arguments.") unless ARGV.size == 1 -usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.") unless File.directory?(TMP) && File.writable?(TMP) + +unless File.directory?(TMP) && File.writable?(TMP) + usage("Temp directory '#{TMP}' is not valid. \ +Set TMPDIR environment variable to a writeable directory.") +end file = ARGV.shift tmpfile = File.join(TMP, File.basename(file)) @@ -39,4 +44,5 @@ contents.gsub!(/def test_should_(\S+)/) {|line| "should \"#{$1.tr('_', ' ')}\" d contents.gsub!(/def test_(\S+)/) {|line| "should \"RENAME ME: test #{$1.tr('_', ' ')}\" do"} File.open(file, 'w') { |f| f.write(contents) } -puts "File '#{file}' has been converted to 'should' syntax. Old version has been stored in '#{tmpfile}'" +puts "File '#{file}' has been converted to 'should' syntax. \ +Old version has been stored in '#{tmpfile}'" diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile index f3d8391c..d1d5d1ab 100644 --- a/gemfiles/rails_6_0.gemfile +++ b/gemfiles/rails_6_0.gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" gem "appraisal" -gem "bundler", "~> 1.0" +gem "bundler", "~> 2.0" gem "byebug" gem "m" gem "minitest" @@ -11,7 +11,9 @@ gem "mocha" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" gem "rake" -gem "rubocop", "0.71.0" +gem "rubocop", require: false +gem "rubocop-packaging", require: false +gem "rubocop-rails", require: false gem "snowglobe", ">= 0.3.0" gem "test-unit" gem "warnings_logger" @@ -27,7 +29,7 @@ gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "bootsnap", ">= 1.4.2", require: false -gem "listen", ">= 3.0.5", "< 3.2" +gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "capybara", ">= 2.15" gem "selenium-webdriver" diff --git a/gemfiles/rails_6_0.gemfile.lock b/gemfiles/rails_6_0.gemfile.lock index fddfc415..2d1584d7 100644 --- a/gemfiles/rails_6_0.gemfile.lock +++ b/gemfiles/rails_6_0.gemfile.lock @@ -61,50 +61,49 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.8.1) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) - appraisal (2.4.1) + appraisal (2.5.0) bundler rake thor (>= 0.14.0) ast (2.4.2) - bcrypt (3.1.18) - bootsnap (1.13.0) + bcrypt (3.1.19) + bootsnap (1.16.0) msgpack (~> 1.2) builder (3.2.4) byebug (10.0.2) - capybara (3.35.3) + capybara (3.39.2) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (3.0.0) coderay (1.1.3) concurrent-ruby (1.2.2) crass (1.0.6) - digest (3.1.1) + date (3.3.3) erubi (1.12.0) ffi (1.15.5) globalid (1.1.0) activesupport (>= 5.0) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) - io-wait (0.3.0) - jaro_winkler (1.5.4) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.19.1) + json (2.6.3) + language_server-protocol (3.17.0.3) + listen (3.5.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) m (1.6.1) method_source (>= 0.6.7) rake (>= 0.9.2.2) @@ -114,39 +113,35 @@ GEM net-pop net-smtp marcel (1.0.2) + matrix (0.4.2) method_source (0.9.2) mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.15.0) - minitest-reporters (1.6.0) + minitest (5.19.0) + minitest-reporters (1.6.1) ansi builder minitest (>= 5.0) ruby-progressbar - mocha (2.0.2) + mocha (2.1.0) ruby2_keywords (>= 0.0.5) - msgpack (1.6.0) - net-imap (0.2.2) - digest + msgpack (1.7.2) + net-imap (0.3.7) + date net-protocol - strscan net-pop (0.1.2) net-protocol - net-protocol (0.1.2) - io-wait + net-protocol (0.2.1) timeout - net-smtp (0.3.0) - digest + net-smtp (0.3.3) net-protocol - timeout - nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nio4r (2.5.9) + nokogiri (1.15.3-x86_64-linux) racc (~> 1.4) - parallel (1.22.1) - parser (3.2.1.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) - pg (1.4.6) + racc + pg (1.5.3) power_assert (2.0.3) pry (0.12.2) coderay (~> 1.1.0) @@ -154,14 +149,14 @@ GEM pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) - public_suffix (4.0.7) + public_suffix (5.0.3) puma (4.3.12) nio4r (~> 2.0) - racc (1.6.2) - rack (2.2.6.2) + racc (1.7.1) + rack (2.2.7) rack-proxy (0.7.6) rack - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) rails (6.0.6.1) actioncable (= 6.0.6.1) @@ -182,11 +177,13 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) railties (6.0.6.1) actionpack (= 6.0.6.1) activesupport (= 6.0.6.1) @@ -198,17 +195,29 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.7.0) - rubocop (0.71.0) - jaro_winkler (~> 1.5.1) + regexp_parser (2.8.1) + rexml (3.2.6) + rubocop (1.55.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - ruby-progressbar (1.12.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-rails (2.20.2) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - ruby_dep (1.5.0) rubyzip (2.3.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -220,9 +229,10 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) + selenium-webdriver (4.9.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) snowglobe (0.3.0) spring (2.1.1) spring-commands-rspec (1.0.4) @@ -238,34 +248,34 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.4) - strscan (3.0.6) - test-unit (3.5.7) + test-unit (3.6.1) power_assert - thor (1.2.1) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.1.0) - timeout (0.3.2) + tilt (2.2.0) + timeout (0.4.0) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.11) thread_safe (~> 0.1) - unicode-display_width (1.6.1) + unicode-display_width (2.4.2) warnings_logger (0.1.1) - webdrivers (4.6.1) + webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) + selenium-webdriver (~> 4.0) webpacker (4.3.0) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) - websocket-driver (0.7.5) + websocket (1.2.9) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.7) + zeitwerk (2.6.9) PLATFORMS ruby @@ -274,11 +284,11 @@ DEPENDENCIES appraisal bcrypt (~> 3.1.7) bootsnap (>= 1.4.2) - bundler (~> 1.0) + bundler (~> 2.0) byebug capybara (>= 2.15) jbuilder (~> 2.7) - listen (>= 3.0.5, < 3.2) + listen (~> 3.3) m minitest minitest-reporters @@ -290,7 +300,9 @@ DEPENDENCIES rails (~> 6.0.2) rails-controller-testing (>= 1.0.4) rake - rubocop (= 0.71.0) + rubocop + rubocop-packaging + rubocop-rails sass-rails (>= 6) selenium-webdriver shoulda-context! @@ -306,4 +318,4 @@ DEPENDENCIES webpacker (~> 4.0) BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index 59881a4b..b6da3e62 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -3,35 +3,37 @@ source "https://rubygems.org" gem "appraisal" -gem "bcrypt", "~> 3.1.7" -gem "bootsnap", ">= 1.4.2", require: false -gem "bundler", "~> 1.0" +gem "bundler", "~> 2.0" gem "byebug" -gem "capybara", ">= 2.15" -gem "jbuilder", "~> 2.7" -gem "listen", ">= 3.0.5", "< 3.2" gem "m" gem "minitest" -gem "minitest-reporters" gem "mocha" -gem "pg", ">= 0.18", "< 2.0" gem "pry", "~> 0.12.0" gem "pry-byebug", "~> 3.6.0" -gem "puma", "~> 5.0" -gem "rails", "~> 6.1.3.2" -gem "rails-controller-testing", ">= 1.0.4" gem "rake" -gem "rubocop", "0.71.0" -gem "sass-rails", ">= 6" -gem "selenium-webdriver" +gem "rubocop", require: false +gem "rubocop-packaging", require: false +gem "rubocop-rails", require: false gem "snowglobe", ">= 0.3.0" +gem "test-unit" +gem "warnings_logger" +gem "sqlite3", "~> 1.4.0" gem "spring" gem "spring-commands-rspec" -gem "spring-watcher-listen", "~> 2.0.0" -gem "sqlite3", "~> 1.4.0" -gem "test-unit" +gem "minitest-reporters" +gem "rails", "~> 6.1.3.2" +gem "puma", "~> 5.0" +gem "sass-rails", ">= 6" gem "turbolinks", "~> 5" -gem "warnings_logger" +gem "jbuilder", "~> 2.7" +gem "bcrypt", "~> 3.1.7" +gem "bootsnap", ">= 1.4.2", require: false +gem "listen", "~> 3.3" +gem "spring-watcher-listen", "~> 2.0.0" +gem "capybara", ">= 2.15" +gem "selenium-webdriver" gem "webdrivers" +gem "rails-controller-testing", ">= 1.0.4" +gem "pg", ">= 0.18", "< 2.0" gemspec path: "../" diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock index ddd1d741..e95e1bb7 100644 --- a/gemfiles/rails_6_1.gemfile.lock +++ b/gemfiles/rails_6_1.gemfile.lock @@ -97,14 +97,14 @@ GEM activesupport (>= 5.0) i18n (1.14.1) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.6) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + json (2.6.3) + language_server-protocol (3.17.0.3) + listen (3.5.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -120,17 +120,16 @@ GEM matrix (0.4.2) method_source (0.9.2) mini_mime (1.0.3) - mini_portile2 (2.8.2) - minitest (5.18.1) - minitest-reporters (1.6.0) + minitest (5.19.0) + minitest-reporters (1.6.1) ansi builder minitest (>= 5.0) ruby-progressbar - mocha (2.0.4) + mocha (2.1.0) ruby2_keywords (>= 0.0.5) - msgpack (1.7.1) - net-imap (0.3.6) + msgpack (1.7.2) + net-imap (0.3.7) date net-protocol net-pop (0.1.2) @@ -140,8 +139,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.3) - mini_portile2 (~> 2.8.2) + nokogiri (1.15.3-x86_64-linux) racc (~> 1.4) parallel (1.23.0) parser (3.2.2.3) @@ -200,17 +198,28 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (2.8.1) - rexml (3.2.5) - rubocop (0.71.0) - jaro_winkler (~> 1.5.1) + rexml (3.2.6) + rubocop (1.55.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-rails (2.20.2) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - ruby_dep (1.5.0) rubyzip (2.3.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -251,19 +260,19 @@ GEM turbolinks-source (5.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (1.6.1) + unicode-display_width (2.4.2) warnings_logger (0.1.1) webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.8) + zeitwerk (2.6.9) PLATFORMS ruby @@ -272,11 +281,11 @@ DEPENDENCIES appraisal bcrypt (~> 3.1.7) bootsnap (>= 1.4.2) - bundler (~> 1.0) + bundler (~> 2.0) byebug capybara (>= 2.15) jbuilder (~> 2.7) - listen (>= 3.0.5, < 3.2) + listen (~> 3.3) m minitest minitest-reporters @@ -288,7 +297,9 @@ DEPENDENCIES rails (~> 6.1.3.2) rails-controller-testing (>= 1.0.4) rake - rubocop (= 0.71.0) + rubocop + rubocop-packaging + rubocop-rails sass-rails (>= 6) selenium-webdriver shoulda-context! @@ -303,4 +314,4 @@ DEPENDENCIES webdrivers BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/lib/shoulda/context/assertions.rb b/lib/shoulda/context/assertions.rb index f2732a08..ba29dc9b 100644 --- a/lib/shoulda/context/assertions.rb +++ b/lib/shoulda/context/assertions.rb @@ -6,7 +6,10 @@ module Assertions # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes) def assert_same_elements(a1, a2, msg = nil) [:select, :inject, :size].each do |m| - [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } + [a1, a2].each do |a| + assert_respond_to(a, m, + "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.",) + end end assert a1h = a1.inject({}) { |h,e| h[e] ||= a1.select { |i| i == e }.size; h } diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index c15b2ffc..2f3ff6d4 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -7,7 +7,9 @@ class Context # :nodoc: attr_accessor :setup_blocks # blocks given via setup methods attr_accessor :teardown_blocks # blocks given via teardown methods attr_accessor :shoulds # array of hashes representing the should statements + # rubocop:disable Layout/LineLength attr_accessor :should_eventuallys # array of hashes representing the should eventually statements + # rubocop:enable Layout/LineLength # accessor with cache def subject_block @@ -205,12 +207,11 @@ def test_name_prefix end end - def method_missing(method, *args, &blk) - test_unit_class.send(method, *args, &blk) + def method_missing(method, *args, **kwargs, &blk) + test_unit_class.send(method, *args, **kwargs, &blk) end end class DuplicateTestError < RuntimeError; end end end - diff --git a/test/shoulda/context_test.rb b/test/shoulda/context_test.rb index 61036e93..d93c5885 100644 --- a/test/shoulda/context_test.rb +++ b/test/shoulda/context_test.rb @@ -28,7 +28,8 @@ def self.context_macro(&blk) end should "be named correctly" do - assert_match(/^test: context with setup block and a subcontext should be named correctly/, normalized_name) + assert_match(/^test: context with setup block and a subcontext should be named correctly/, + normalized_name) end should "run the setup blocks in order" do @@ -37,9 +38,14 @@ def self.context_macro(&blk) end context_macro do + # rubocop:disable Layout/LineLength should "have name set right" do - assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, normalized_name) + assert_match( + /^test: context with setup block with a subcontext made by a macro should have name set right/, + normalized_name + ) end + # rubocop:enable Layout/LineLength should "run the setup block of that context macro" do assert_equal :foo, @context_macro @@ -108,11 +114,13 @@ def hello; "hi"; end teardown { cleanup_count -= 1 } end + # rubocop:disable Layout/LineLength 2.times do |i| should "also call all setups and all teardowns in parent and subcontext (check ##{i + 1})" do assert_equal 4, cleanup_count end end + # rubocop:enable Layout/LineLength end diff --git a/test/shoulda/convert_to_should_syntax_test.rb b/test/shoulda/convert_to_should_syntax_test.rb index c984f728..69b85225 100644 --- a/test/shoulda/convert_to_should_syntax_test.rb +++ b/test/shoulda/convert_to_should_syntax_test.rb @@ -47,7 +47,8 @@ def non_test_method def test_convert_to_should_syntax File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)} - cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../exe/convert_to_should_syntax')} #{FIXTURE_PATH}" + cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), + '../../exe/convert_to_should_syntax',)} #{FIXTURE_PATH}" output = `#{cmd}` File.unlink($1) if output.match(/has been stored in '([^']+)/) assert_match(/has been converted/, output)