Unverified Commit 2775001d by Andrew W. Lee Committed by GitHub

Tidy spec directory (#646)

In looking into #563, I realized there are gaps in test coverage. For example, `bin/annotate` doesn't have any tests. Tidying the spec directory to make it easier to add tests in future work.
parent 0917c075
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2019-06-16 12:01:03 -0700 using RuboCop version 0.68.1. # on 2019-09-02 16:23:56 -0700 using RuboCop version 0.68.1.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
...@@ -49,9 +49,9 @@ Gemspec/RequiredRubyVersion: ...@@ -49,9 +49,9 @@ Gemspec/RequiredRubyVersion:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/AlignArray: Layout/AlignArray:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 104 # Offense count: 107
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table # SupportedHashRocketStyles: key, separator, table
...@@ -60,11 +60,11 @@ Layout/AlignArray: ...@@ -60,11 +60,11 @@ Layout/AlignArray:
Layout/AlignHash: Layout/AlignHash:
Exclude: Exclude:
- 'lib/generators/annotate/templates/auto_annotate_models.rake' - 'lib/generators/annotate/templates/auto_annotate_models.rake'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_2.3_with_bundler/config/initializers/unified_initializer.rb' - 'spec/integration/rails_2.3_with_bundler/config/initializers/unified_initializer.rb'
- 'spec/integration/rails_4.1.1/lib/tasks/auto_annotate_models.rake' - 'spec/integration/rails_4.1.1/lib/tasks/auto_annotate_models.rake'
- 'spec/integration/rails_4.2.0/lib/tasks/auto_annotate_models.rake' - 'spec/integration/rails_4.2.0/lib/tasks/auto_annotate_models.rake'
- 'spec/integration/standalone/config/init.rb' - 'spec/integration/standalone/config/init.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -78,7 +78,6 @@ Layout/BlockAlignment: ...@@ -78,7 +78,6 @@ Layout/BlockAlignment:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/ClosingHeredocIndentation: Layout/ClosingHeredocIndentation:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_2.3_with_bundler.rb' - 'spec/integration/rails_2.3_with_bundler.rb'
- 'spec/integration/rails_3.2.2.rb' - 'spec/integration/rails_3.2.2.rb'
- 'spec/integration/rails_3.2.8.rb' - 'spec/integration/rails_3.2.8.rb'
...@@ -86,8 +85,9 @@ Layout/ClosingHeredocIndentation: ...@@ -86,8 +85,9 @@ Layout/ClosingHeredocIndentation:
- 'spec/integration/rails_3.2_custom_inflections.rb' - 'spec/integration/rails_3.2_custom_inflections.rb'
- 'spec/integration/rails_3.2_with_asset_pipeline.rb' - 'spec/integration/rails_3.2_with_asset_pipeline.rb'
- 'spec/integration/standalone.rb' - 'spec/integration/standalone.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 14 # Offense count: 13
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause: Layout/EmptyLineAfterGuardClause:
Exclude: Exclude:
...@@ -102,7 +102,6 @@ Layout/EmptyLineAfterGuardClause: ...@@ -102,7 +102,6 @@ Layout/EmptyLineAfterGuardClause:
Layout/EmptyLineAfterMagicComment: Layout/EmptyLineAfterMagicComment:
Exclude: Exclude:
- 'annotate.gemspec' - 'annotate.gemspec'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_3.2.2/db/schema.rb' - 'spec/integration/rails_3.2.2/db/schema.rb'
- 'spec/integration/rails_3.2.8/db/schema.rb' - 'spec/integration/rails_3.2.8/db/schema.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb' - 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb'
...@@ -111,6 +110,7 @@ Layout/EmptyLineAfterMagicComment: ...@@ -111,6 +110,7 @@ Layout/EmptyLineAfterMagicComment:
- 'spec/integration/rails_4.1.1/db/schema.rb' - 'spec/integration/rails_4.1.1/db/schema.rb'
- 'spec/integration/rails_4.2.0/db/schema.rb' - 'spec/integration/rails_4.2.0/db/schema.rb'
- 'spec/integration/standalone/db/schema.rb' - 'spec/integration/standalone/db/schema.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 2 # Offense count: 2
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -129,7 +129,7 @@ Layout/EmptyLinesAroundAccessModifier: ...@@ -129,7 +129,7 @@ Layout/EmptyLinesAroundAccessModifier:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Layout/EmptyLinesAroundArguments: Layout/EmptyLinesAroundArguments:
Exclude: Exclude:
- 'spec/annotate/annotate_routes_spec.rb' - 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 6 # Offense count: 6
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -179,7 +179,6 @@ Layout/IndentFirstHashElement: ...@@ -179,7 +179,6 @@ Layout/IndentFirstHashElement:
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc: Layout/IndentHeredoc:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/integration_spec.rb' - 'spec/integration/integration_spec.rb'
- 'spec/integration/rails_2.3_with_bundler.rb' - 'spec/integration/rails_2.3_with_bundler.rb'
- 'spec/integration/rails_3.2.2.rb' - 'spec/integration/rails_3.2.2.rb'
...@@ -188,6 +187,7 @@ Layout/IndentHeredoc: ...@@ -188,6 +187,7 @@ Layout/IndentHeredoc:
- 'spec/integration/rails_3.2_custom_inflections.rb' - 'spec/integration/rails_3.2_custom_inflections.rb'
- 'spec/integration/rails_3.2_with_asset_pipeline.rb' - 'spec/integration/rails_3.2_with_asset_pipeline.rb'
- 'spec/integration/standalone.rb' - 'spec/integration/standalone.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -214,7 +214,7 @@ Layout/IndentationWidth: ...@@ -214,7 +214,7 @@ Layout/IndentationWidth:
# SupportedStyles: aligned, indented, indented_relative_to_receiver # SupportedStyles: aligned, indented, indented_relative_to_receiver
Layout/MultilineMethodCallIndentation: Layout/MultilineMethodCallIndentation:
Exclude: Exclude:
- 'spec/annotate/annotate_routes_spec.rb' - 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 5 # Offense count: 5
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -339,8 +339,8 @@ Layout/TrailingBlankLines: ...@@ -339,8 +339,8 @@ Layout/TrailingBlankLines:
# Configuration parameters: AllowInHeredoc. # Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace: Layout/TrailingWhitespace:
Exclude: Exclude:
- 'spec/annotate/annotate_routes_spec.rb'
- 'spec/integration/rails_2.3_with_bundler/db/schema.rb' - 'spec/integration/rails_2.3_with_bundler/db/schema.rb'
- 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 3 # Offense count: 3
# Configuration parameters: AllowSafeAssignment. # Configuration parameters: AllowSafeAssignment.
...@@ -349,12 +349,6 @@ Lint/AssignmentInCondition: ...@@ -349,12 +349,6 @@ Lint/AssignmentInCondition:
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
- 'spec/integration/rails_2.3_with_bundler/config/boot.rb' - 'spec/integration/rails_2.3_with_bundler/config/boot.rb'
# Offense count: 2
# Cop supports --auto-correct.
Lint/BigDecimalNew:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
# Offense count: 6 # Offense count: 6
# Cop supports --auto-correct. # Cop supports --auto-correct.
Lint/DeprecatedClassMethods: Lint/DeprecatedClassMethods:
...@@ -412,18 +406,11 @@ Lint/ShadowingOuterLocalVariable: ...@@ -412,18 +406,11 @@ Lint/ShadowingOuterLocalVariable:
Exclude: Exclude:
- 'Rakefile' - 'Rakefile'
# Offense count: 7 # Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'bin/annotate'
# Offense count: 19
Metrics/AbcSize: Metrics/AbcSize:
Max: 138 Max: 138
# Offense count: 27 # Offense count: 28
# Configuration parameters: CountComments, ExcludedMethods. # Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine # ExcludedMethods: refine
Metrics/BlockLength: Metrics/BlockLength:
...@@ -438,7 +425,7 @@ Metrics/BlockNesting: ...@@ -438,7 +425,7 @@ Metrics/BlockNesting:
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 36 Max: 36
# Offense count: 29 # Offense count: 30
# Configuration parameters: CountComments, ExcludedMethods. # Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength: Metrics/MethodLength:
Max: 75 Max: 75
...@@ -457,8 +444,8 @@ Naming/AccessorMethodName: ...@@ -457,8 +444,8 @@ Naming/AccessorMethodName:
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$)) # Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming: Naming/HeredocDelimiterNaming:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/annotate_models_spec.rb'
- 'spec/annotate/annotate_routes_spec.rb' - 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 2 # Offense count: 2
# Configuration parameters: EnforcedStyleForLeadingUnderscores. # Configuration parameters: EnforcedStyleForLeadingUnderscores.
...@@ -533,14 +520,6 @@ Style/ClassVars: ...@@ -533,14 +520,6 @@ Style/ClassVars:
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'bin/annotate'
# Offense count: 1
# Cop supports --auto-correct.
Style/Dir: Style/Dir:
Exclude: Exclude:
- 'bin/annotate' - 'bin/annotate'
...@@ -562,7 +541,6 @@ Style/Documentation: ...@@ -562,7 +541,6 @@ Style/Documentation:
Style/Encoding: Style/Encoding:
Exclude: Exclude:
- 'annotate.gemspec' - 'annotate.gemspec'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_3.2.2/db/schema.rb' - 'spec/integration/rails_3.2.2/db/schema.rb'
- 'spec/integration/rails_3.2.8/db/schema.rb' - 'spec/integration/rails_3.2.8/db/schema.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb' - 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb'
...@@ -571,6 +549,7 @@ Style/Encoding: ...@@ -571,6 +549,7 @@ Style/Encoding:
- 'spec/integration/rails_4.1.1/db/schema.rb' - 'spec/integration/rails_4.1.1/db/schema.rb'
- 'spec/integration/rails_4.2.0/db/schema.rb' - 'spec/integration/rails_4.2.0/db/schema.rb'
- 'spec/integration/standalone/db/schema.rb' - 'spec/integration/standalone/db/schema.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 48 # Offense count: 48
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -593,7 +572,7 @@ Style/FormatStringToken: ...@@ -593,7 +572,7 @@ Style/FormatStringToken:
Exclude: Exclude:
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
# Offense count: 184 # Offense count: 186
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.
# SupportedStyles: when_needed, always, never # SupportedStyles: when_needed, always, never
...@@ -690,17 +669,15 @@ Style/NumericPredicate: ...@@ -690,17 +669,15 @@ Style/NumericPredicate:
- 'lib/annotate.rb' - 'lib/annotate.rb'
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
# Offense count: 24 # Offense count: 20
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters. # Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters: Style/PercentLiteralDelimiters:
Exclude: Exclude:
- 'annotate.gemspec' - 'annotate.gemspec'
- 'bin/annotate'
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
- 'lib/annotate/annotate_routes.rb' - 'lib/annotate/annotate_routes.rb'
- 'lib/tasks/annotate_models_migrate.rake' - 'lib/tasks/annotate_models_migrate.rake'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_3.2.2/config/application.rb' - 'spec/integration/rails_3.2.2/config/application.rb'
- 'spec/integration/rails_3.2.8/config/application.rb' - 'spec/integration/rails_3.2.8/config/application.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/config/application.rb' - 'spec/integration/rails_3.2_autoloading_factory_girl/config/application.rb'
...@@ -708,8 +685,9 @@ Style/PercentLiteralDelimiters: ...@@ -708,8 +685,9 @@ Style/PercentLiteralDelimiters:
- 'spec/integration/rails_3.2_with_asset_pipeline/config/application.rb' - 'spec/integration/rails_3.2_with_asset_pipeline/config/application.rb'
- 'spec/integration/rails_4.1.1/app/models/task.rb' - 'spec/integration/rails_4.1.1/app/models/task.rb'
- 'spec/integration/rails_4.2.0/app/models/task.rb' - 'spec/integration/rails_4.2.0/app/models/task.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
- 'spec/lib/tasks/annotate_models_migrate_spec.rb'
- 'spec/spec_helper.rb' - 'spec/spec_helper.rb'
- 'spec/tasks/annotate_models_migrate_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -730,7 +708,7 @@ Style/RaiseArgs: ...@@ -730,7 +708,7 @@ Style/RaiseArgs:
Style/RedundantBegin: Style/RedundantBegin:
Exclude: Exclude:
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
- 'spec/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -784,12 +762,11 @@ Style/SafeNavigation: ...@@ -784,12 +762,11 @@ Style/SafeNavigation:
Exclude: Exclude:
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
# Offense count: 2 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowAsExpressionSeparator. # Configuration parameters: AllowAsExpressionSeparator.
Style/Semicolon: Style/Semicolon:
Exclude: Exclude:
- 'bin/annotate'
- 'spec/integration/rails_2.3_with_bundler/config/initializers/unified_initializer.rb' - 'spec/integration/rails_2.3_with_bundler/config/initializers/unified_initializer.rb'
# Offense count: 18 # Offense count: 18
...@@ -801,7 +778,7 @@ Style/StderrPuts: ...@@ -801,7 +778,7 @@ Style/StderrPuts:
- 'lib/annotate/annotate_models.rb' - 'lib/annotate/annotate_models.rb'
- 'spec/integration/rails_2.3_with_bundler/config/boot.rb' - 'spec/integration/rails_2.3_with_bundler/config/boot.rb'
# Offense count: 243 # Offense count: 247
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes # SupportedStyles: single_quotes, double_quotes
...@@ -827,7 +804,7 @@ Style/SymbolArray: ...@@ -827,7 +804,7 @@ Style/SymbolArray:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/SymbolLiteral: Style/SymbolLiteral:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -835,7 +812,7 @@ Style/SymbolLiteral: ...@@ -835,7 +812,7 @@ Style/SymbolLiteral:
# SupportedStylesForMultiline: comma, consistent_comma, no_comma # SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral: Style/TrailingCommaInArrayLiteral:
Exclude: Exclude:
- 'spec/annotate/annotate_models_spec.rb' - 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 2 # Offense count: 2
# Cop supports --auto-correct. # Cop supports --auto-correct.
...@@ -846,12 +823,6 @@ Style/TrailingCommaInHashLiteral: ...@@ -846,12 +823,6 @@ Style/TrailingCommaInHashLiteral:
- 'spec/integration/rails_4.1.1/lib/tasks/auto_annotate_models.rake' - 'spec/integration/rails_4.1.1/lib/tasks/auto_annotate_models.rake'
- 'spec/integration/rails_4.2.0/lib/tasks/auto_annotate_models.rake' - 'spec/integration/rails_4.2.0/lib/tasks/auto_annotate_models.rake'
# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Exclude:
- 'bin/annotate'
# Offense count: 4 # Offense count: 4
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/UnneededPercentQ: Style/UnneededPercentQ:
...@@ -859,7 +830,7 @@ Style/UnneededPercentQ: ...@@ -859,7 +830,7 @@ Style/UnneededPercentQ:
- 'annotate.gemspec' - 'annotate.gemspec'
- 'spec/integration/rails_2.3_with_bundler/config/boot.rb' - 'spec/integration/rails_2.3_with_bundler/config/boot.rb'
# Offense count: 431 # Offense count: 465
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https # URISchemes: http, https
......
# encoding: utf-8 # encoding: utf-8
require File.dirname(__FILE__) + '/../spec_helper.rb' require_relative '../../spec_helper'
require 'annotate/annotate_models' require 'annotate/annotate_models'
require 'annotate/active_record_patch' require 'annotate/active_record_patch'
require 'active_support/core_ext/string' require 'active_support/core_ext/string'
...@@ -1819,7 +1819,7 @@ end ...@@ -1819,7 +1819,7 @@ end
end end
expect(error_output).to include("Unable to annotate #{@model_dir}/user.rb: oops") expect(error_output).to include("Unable to annotate #{@model_dir}/user.rb: oops")
expect(error_output).to include('/spec/annotate/annotate_models_spec.rb:') expect(error_output).to include('/spec/lib/annotate/annotate_models_spec.rb:')
end end
end end
......
require File.dirname(__FILE__) + '/../spec_helper.rb' require_relative '../../spec_helper'
require 'annotate/annotate_routes' require 'annotate/annotate_routes'
describe AnnotateRoutes do describe AnnotateRoutes do
......
require File.dirname(__FILE__) + '/../spec_helper.rb' require_relative '../../spec_helper'
module Annotate # rubocop:disable Metrics/ModuleLength module Annotate # rubocop:disable Metrics/ModuleLength
describe Parser do # rubocop:disable Metrics/BlockLength describe Parser do # rubocop:disable Metrics/BlockLength
......
require File.dirname(__FILE__) + '/spec_helper.rb' require_relative '../spec_helper'
describe Annotate do describe Annotate do
it 'should have a version' do it 'should have a version' do
......
require_relative '../spec_helper' require_relative '../../spec_helper'
describe 'ActiveRecord migration rake task hooks' do describe 'ActiveRecord migration rake task hooks' do
before do before do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment