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
# `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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
......@@ -49,9 +49,9 @@ Gemspec/RequiredRubyVersion:
# Cop supports --auto-correct.
Layout/AlignArray:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 104
# Offense count: 107
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
......@@ -60,11 +60,11 @@ Layout/AlignArray:
Layout/AlignHash:
Exclude:
- '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_4.1.1/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/lib/annotate/annotate_models_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
......@@ -78,7 +78,6 @@ Layout/BlockAlignment:
# Cop supports --auto-correct.
Layout/ClosingHeredocIndentation:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_2.3_with_bundler.rb'
- 'spec/integration/rails_3.2.2.rb'
- 'spec/integration/rails_3.2.8.rb'
......@@ -86,8 +85,9 @@ Layout/ClosingHeredocIndentation:
- 'spec/integration/rails_3.2_custom_inflections.rb'
- 'spec/integration/rails_3.2_with_asset_pipeline.rb'
- 'spec/integration/standalone.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 14
# Offense count: 13
# Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause:
Exclude:
......@@ -102,7 +102,6 @@ Layout/EmptyLineAfterGuardClause:
Layout/EmptyLineAfterMagicComment:
Exclude:
- 'annotate.gemspec'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_3.2.2/db/schema.rb'
- 'spec/integration/rails_3.2.8/db/schema.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb'
......@@ -111,6 +110,7 @@ Layout/EmptyLineAfterMagicComment:
- 'spec/integration/rails_4.1.1/db/schema.rb'
- 'spec/integration/rails_4.2.0/db/schema.rb'
- 'spec/integration/standalone/db/schema.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
......@@ -129,7 +129,7 @@ Layout/EmptyLinesAroundAccessModifier:
# Cop supports --auto-correct.
Layout/EmptyLinesAroundArguments:
Exclude:
- 'spec/annotate/annotate_routes_spec.rb'
- 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.
......@@ -179,7 +179,6 @@ Layout/IndentFirstHashElement:
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/integration_spec.rb'
- 'spec/integration/rails_2.3_with_bundler.rb'
- 'spec/integration/rails_3.2.2.rb'
......@@ -188,6 +187,7 @@ Layout/IndentHeredoc:
- 'spec/integration/rails_3.2_custom_inflections.rb'
- 'spec/integration/rails_3.2_with_asset_pipeline.rb'
- 'spec/integration/standalone.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
......@@ -214,7 +214,7 @@ Layout/IndentationWidth:
# SupportedStyles: aligned, indented, indented_relative_to_receiver
Layout/MultilineMethodCallIndentation:
Exclude:
- 'spec/annotate/annotate_routes_spec.rb'
- 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 5
# Cop supports --auto-correct.
......@@ -339,8 +339,8 @@ Layout/TrailingBlankLines:
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'spec/annotate/annotate_routes_spec.rb'
- 'spec/integration/rails_2.3_with_bundler/db/schema.rb'
- 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 3
# Configuration parameters: AllowSafeAssignment.
......@@ -349,12 +349,6 @@ Lint/AssignmentInCondition:
- 'lib/annotate/annotate_models.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
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
......@@ -412,18 +406,11 @@ Lint/ShadowingOuterLocalVariable:
Exclude:
- 'Rakefile'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'bin/annotate'
# Offense count: 19
# Offense count: 20
Metrics/AbcSize:
Max: 138
# Offense count: 27
# Offense count: 28
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
......@@ -438,7 +425,7 @@ Metrics/BlockNesting:
Metrics/CyclomaticComplexity:
Max: 36
# Offense count: 29
# Offense count: 30
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 75
......@@ -457,8 +444,8 @@ Naming/AccessorMethodName:
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/annotate/annotate_routes_spec.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
- 'spec/lib/annotate/annotate_routes_spec.rb'
# Offense count: 2
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
......@@ -533,14 +520,6 @@ Style/ClassVars:
# Offense count: 1
# 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:
Exclude:
- 'bin/annotate'
......@@ -562,7 +541,6 @@ Style/Documentation:
Style/Encoding:
Exclude:
- 'annotate.gemspec'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/integration/rails_3.2.2/db/schema.rb'
- 'spec/integration/rails_3.2.8/db/schema.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/db/schema.rb'
......@@ -571,6 +549,7 @@ Style/Encoding:
- 'spec/integration/rails_4.1.1/db/schema.rb'
- 'spec/integration/rails_4.2.0/db/schema.rb'
- 'spec/integration/standalone/db/schema.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 48
# Cop supports --auto-correct.
......@@ -593,7 +572,7 @@ Style/FormatStringToken:
Exclude:
- 'lib/annotate/annotate_models.rb'
# Offense count: 184
# Offense count: 186
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: when_needed, always, never
......@@ -690,17 +669,15 @@ Style/NumericPredicate:
- 'lib/annotate.rb'
- 'lib/annotate/annotate_models.rb'
# Offense count: 24
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Exclude:
- 'annotate.gemspec'
- 'bin/annotate'
- 'lib/annotate/annotate_models.rb'
- 'lib/annotate/annotate_routes.rb'
- '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.8/config/application.rb'
- 'spec/integration/rails_3.2_autoloading_factory_girl/config/application.rb'
......@@ -708,8 +685,9 @@ Style/PercentLiteralDelimiters:
- '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.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/tasks/annotate_models_migrate_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
......@@ -730,7 +708,7 @@ Style/RaiseArgs:
Style/RedundantBegin:
Exclude:
- 'lib/annotate/annotate_models.rb'
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
......@@ -784,12 +762,11 @@ Style/SafeNavigation:
Exclude:
- 'lib/annotate/annotate_models.rb'
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowAsExpressionSeparator.
Style/Semicolon:
Exclude:
- 'bin/annotate'
- 'spec/integration/rails_2.3_with_bundler/config/initializers/unified_initializer.rb'
# Offense count: 18
......@@ -801,7 +778,7 @@ Style/StderrPuts:
- 'lib/annotate/annotate_models.rb'
- 'spec/integration/rails_2.3_with_bundler/config/boot.rb'
# Offense count: 243
# Offense count: 247
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
......@@ -827,7 +804,7 @@ Style/SymbolArray:
# Cop supports --auto-correct.
Style/SymbolLiteral:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
......@@ -835,7 +812,7 @@ Style/SymbolLiteral:
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral:
Exclude:
- 'spec/annotate/annotate_models_spec.rb'
- 'spec/lib/annotate/annotate_models_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
......@@ -846,12 +823,6 @@ Style/TrailingCommaInHashLiteral:
- 'spec/integration/rails_4.1.1/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
# Cop supports --auto-correct.
Style/UnneededPercentQ:
......@@ -859,7 +830,7 @@ Style/UnneededPercentQ:
- 'annotate.gemspec'
- 'spec/integration/rails_2.3_with_bundler/config/boot.rb'
# Offense count: 431
# Offense count: 465
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
......
# encoding: utf-8
require File.dirname(__FILE__) + '/../spec_helper.rb'
require_relative '../../spec_helper'
require 'annotate/annotate_models'
require 'annotate/active_record_patch'
require 'active_support/core_ext/string'
......@@ -1819,7 +1819,7 @@ end
end
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
......
require File.dirname(__FILE__) + '/../spec_helper.rb'
require_relative '../../spec_helper'
require 'annotate/annotate_routes'
describe AnnotateRoutes do
......
require File.dirname(__FILE__) + '/../spec_helper.rb'
require_relative '../../spec_helper'
module Annotate # rubocop:disable Metrics/ModuleLength
describe Parser do # rubocop:disable Metrics/BlockLength
......
require File.dirname(__FILE__) + '/spec_helper.rb'
require_relative '../spec_helper'
describe Annotate do
it 'should have a version' do
......
require_relative '../spec_helper'
require_relative '../../spec_helper'
describe 'ActiveRecord migration rake task hooks' 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