Add RuboCop suite and RSpec

Public
This template adds RSpec, Faker and RuboCop suite to Rails application.
Used 10 times
Created by
J Jokūbas Pučinskas

Usage
This template replaces Rails omakase RuboCop configuration.
rails new my-app --skip-rubocop -m template.rb

RuboCop is preconfigured by creating .rubocop.yml 

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/V2GspN"
Template Source

Review the code before running this template on your machine.

### README FIRST
# RuboCop:
# This template replaces rails rubocop omakase with it's own rubocop config
# Please use "--skip-rubocop" flag

gem_group :development, :test do
  gem "factory_bot_rails"
  gem "faker"
  gem "rspec-rails"
  gem "rubocop"
  gem "rubocop-factory_bot", require: false
  gem "rubocop-faker", require: false
  gem "rubocop-performance", require: false
  gem "rubocop-rails", require: false
  gem "rubocop-rspec", require: false
  gem "rubocop-rspec_rails", require: false
end

file ".rubocop.yml", <<-CODE
require:
  - rubocop-factory_bot
  - rubocop-faker
  - rubocop-performance
  - rubocop-rails
  - rubocop-rspec
  - rubocop-rspec_rails

AllCops:
  NewCops: enable
  SuggestExtensions: true

Style/StringLiterals:
  Enabled: true
  EnforcedStyle: double_quotes

Style/Documentation:
  Enabled: false

Style/TrailingCommaInArguments:
  Enabled: true
  EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArrayLiteral:
  Enabled: true

Style/TrailingCommaInHashLiteral:
  Enabled: true

Style/ClassAndModuleChildren:
  Enabled: true
  EnforcedStyle: compact
  Exclude:
    - config/application.rb
CODE

after_bundle do
  generate "rspec:install"
end
Comments

Sign up or Login to leave a comment.