Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 8 additions & 36 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,19 @@
inherit_gem:
rubocop-rails_config:
- config/rails.yml

# Override Setting
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
NewCops: enable
Include:
- "spec/**/*"
Exclude:
- "lib/**/*"
Style/PercentLiteralDelimiters:
PreferredDelimiters:
"%i": "()"
"%w": "()"
Style/StringLiterals:
Enabled: true
EnforcedStyle: single_quotes

# Metrics Cops
Metrics/ClassLength:
Description: 'Avoid classes longer than 100 lines of code.'
Max: 100
Enabled: true

Metrics/ModuleLength:
Description: 'Avoid modules longer than 100 lines of code.'
Max: 100
Enabled: true

Metrics/ParameterLists:
Description: 'Pass no more than four parameters into a method.'
Max: 4
Enabled: true

Metrics/MethodLength:
Description: 'Avoid methods longer than 5 lines of code.'
StyleGuide: '<https://github.com/bbatsov/ruby-style-guide#short-methods>'
Max: 5
Enabled: true
- "bin/**/*"

Metrics/BlockLength:
CountComments: false
Max: 5
IgnoredMethods:
- context
- describe
Expand Down
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem 'debug', platforms: %i( mri mingw x64_mingw )
gem 'rspec-rails', '~> 5.0.0'
gem 'rubocop-rails_config'
gem 'annotate'
gem 'pry'
gem 'dotenv-rails'
gem 'rubocop', require: false
gem 'rubocop-performance'
gem 'rubocop-rails', require: false
gem 'rubocop-rspec', require: false
end

group :development do
Expand Down
21 changes: 7 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -257,25 +257,15 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.17.0)
parser (>= 3.1.1.0)
rubocop-minitest (0.19.1)
rubocop (>= 0.90, < 2.0)
rubocop-packaging (0.5.1)
rubocop (>= 0.89, < 2.0)
rubocop-performance (1.13.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.14.2)
rubocop-rails (2.13.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rails_config (1.9.1)
railties (>= 5.0)
rubocop (>= 1.25.1)
rubocop-ast (>= 1.0.1)
rubocop-minitest (~> 0.15)
rubocop-packaging (~> 0.5)
rubocop-performance (~> 1.11)
rubocop-rails (~> 2.0)
rubocop-rspec (2.9.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
ruby_parser (3.19.1)
sexp_processor (~> 4.16)
Expand Down Expand Up @@ -363,7 +353,10 @@ DEPENDENCIES
rails (~> 7.0.2.3)
redis (~> 4.0)
rspec-rails (~> 5.0.0)
rubocop-rails_config
rubocop
rubocop-performance
rubocop-rails
rubocop-rspec
selenium-webdriver
sidekiq
simplecov
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }

# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
Expand Down
96 changes: 47 additions & 49 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,51 @@
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus

# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"

# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!

# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = "doc"
end

# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random

# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
# # This allows you to limit a spec run to individual examples or groups
# # you care about by tagging them with `:focus` metadata. When nothing
# # is tagged with `:focus`, all examples get run. RSpec also provides
# # aliases for `it`, `describe`, and `context` that include `:focus`
# # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
# config.filter_run_when_matching :focus
#
# # Allows RSpec to persist some state between runs in order to support
# # the `--only-failures` and `--next-failure` CLI options. We recommend
# # you configure your source control system to ignore this file.
# config.example_status_persistence_file_path = "spec/examples.txt"
#
# # Limits the available syntax to the non-monkey patched syntax that is
# # recommended. For more details, see:
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
# config.disable_monkey_patching!
#
# # Many RSpec users commonly either run the entire suite or an individual
# # file, and it's useful to allow more verbose output when running an
# # individual spec file.
# if config.files_to_run.one?
# # Use the documentation formatter for detailed output,
# # unless a formatter has already been configured
# # (e.g. via a command-line flag).
# config.default_formatter = "doc"
# end
#
# # Print the 10 slowest examples and example groups at the
# # end of the spec run, to help surface which specs are running
# # particularly slow.
# config.profile_examples = 10
#
# # Run specs in random order to surface order dependencies. If you find an
# # order dependency and want to debug it, you can fix the order by providing
# # the seed, which is printed after each run.
# # --seed 1234
# config.order = :random
#
# # Seed global randomization in this process using the `--seed` CLI option.
# # Setting this allows you to use `--seed` to deterministically reproduce
# # test failures related to randomization by passing the same `--seed` value
# # as the one that triggered the failure.
# Kernel.srand config.seed
end
2 changes: 1 addition & 1 deletion spec/support/database_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

# start the transaction strategy as examples are run
config.around(:each) do |example|
config.around do |example|
DatabaseCleaner.cleaning do
example.run
end
Expand Down