diff --git a/.rubocop.yml b/.rubocop.yml index f9d86d4a..932ff54b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,24 @@ # Omakase Ruby styling for Rails inherit_gem: { rubocop-rails-omakase: rubocop.yml } +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + Include: + - "app/**/*" + - "config/**/*" + - "lib/**/*" + - "spec/**/*" + - "Gemfile" +Bundler/OrderedGems: + Enabled: true + # Overwrite or add rules to create your own house style # # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]` diff --git a/Gemfile b/Gemfile index a4f15bf9..d058b0d2 100644 --- a/Gemfile +++ b/Gemfile @@ -24,9 +24,9 @@ gem "bcrypt", "~> 3.1.7" gem "tzinfo-data", platforms: %i[ windows jruby ] # Use the database-backed adapters for Rails.cache, Active Job, and Action Cable +gem "solid_cable" gem "solid_cache" gem "solid_queue" -gem "solid_cable" # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", require: false @@ -46,17 +46,17 @@ group :development, :test do # Static analysis for security vulnerabilities [https://brakemanscanner.org/] gem "brakeman", require: false + gem "factory_bot_rails" # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/] gem "rubocop-rails-omakase", require: false gem "rspec-rails" - gem "factory_bot_rails" end group :development do - gem "hotwire-spark" gem "bullet" + gem "hotwire-spark" gem "letter_opener" # Use console on exceptions pages [https://github.com/rails/web-console] gem "web-console" diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index c0b717f7..ee2ed8c2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -4,5 +4,5 @@ # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ - :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc, ] diff --git a/spec/models/region_spec.rb b/spec/models/region_spec.rb index d6e64632..136a81fa 100644 --- a/spec/models/region_spec.rb +++ b/spec/models/region_spec.rb @@ -1,4 +1,4 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe Region, type: :model do it { should validate_presence_of(:name) } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9653b58a..23db340f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,13 +1,13 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' -require 'spec_helper' -ENV['RAILS_ENV'] ||= 'test' -require_relative '../config/environment' +require "spec_helper" +ENV["RAILS_ENV"] ||= "test" +require_relative "../config/environment" # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? # Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file # that will avoid rails generators crashing because migrations haven't been run yet # return unless Rails.env.test? -require 'rspec/rails' +require "rspec/rails" # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in @@ -32,11 +32,11 @@ rescue ActiveRecord::PendingMigrationError => e abort e.to_s.strip end -Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each(&method(:require)) +Dir[Rails.root.join("spec", "support", "**", "*.rb")].each(&method(:require)) RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_paths = [ - Rails.root.join('spec/fixtures') + Rails.root.join("spec/fixtures"), ] # If you're not using ActiveRecord, or you'd prefer not to run each of your diff --git a/spec/views/regions/edit.html.erb_spec.rb b/spec/views/regions/edit.html.erb_spec.rb index 6e3cbbd3..132fe53a 100644 --- a/spec/views/regions/edit.html.erb_spec.rb +++ b/spec/views/regions/edit.html.erb_spec.rb @@ -1,9 +1,9 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe "regions/edit", type: :view do let(:region) { Region.create!( - name: "MyString" + name: "MyString", ) } diff --git a/spec/views/regions/index.html.erb_spec.rb b/spec/views/regions/index.html.erb_spec.rb index e37b23e9..e8ad23ec 100644 --- a/spec/views/regions/index.html.erb_spec.rb +++ b/spec/views/regions/index.html.erb_spec.rb @@ -1,20 +1,19 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe "regions/index", type: :view do before(:each) do - assign(:regions, [ - Region.create!( - name: "Name" - ), - Region.create!( - name: "Name" - ) - ]) + assign( + :regions, + [ + Region.create!(name: "Name"), + Region.create!(name: "Name"), + ], + ) end it "renders a list of regions" do render - cell_selector = 'table>tbody>tr' + cell_selector = "table>tbody>tr" assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2 end end diff --git a/spec/views/regions/new.html.erb_spec.rb b/spec/views/regions/new.html.erb_spec.rb index 1c312f11..3ed38b73 100644 --- a/spec/views/regions/new.html.erb_spec.rb +++ b/spec/views/regions/new.html.erb_spec.rb @@ -1,10 +1,8 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe "regions/new", type: :view do before(:each) do - assign(:region, Region.new( - name: "MyString" - )) + assign(:region, Region.new(name: "MyString")) end it "renders new region form" do diff --git a/spec/views/regions/show.html.erb_spec.rb b/spec/views/regions/show.html.erb_spec.rb index d80cff16..c8ed1ce1 100644 --- a/spec/views/regions/show.html.erb_spec.rb +++ b/spec/views/regions/show.html.erb_spec.rb @@ -1,10 +1,8 @@ -require 'rails_helper' +require "rails_helper" RSpec.describe "regions/show", type: :view do before(:each) do - assign(:region, Region.create!( - name: "Name" - )) + assign(:region, Region.create!(name: "Name")) end it "renders attributes in
" do