diff --git a/.rubocop.yml b/.rubocop.yml index a3e582e..2d63c01 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,7 @@ AllCops: Exclude: - 'bin/*' - 'db/schema.rb' + NewCops: enable Style/ClassAndModuleChildren: Exclude: @@ -17,6 +18,6 @@ Style/Documentation: - 'db/**/*' - 'test/**/*' -Metrics/LineLength: +Layout/LineLength: Max: 80 IgnoredPatterns: ['\A\s*#'] diff --git a/Gemfile b/Gemfile index 0edc5a3..6e9a12d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' git_source(:github) do |repo_name| @@ -6,7 +8,7 @@ git_source(:github) do |repo_name| end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.1.7' +gem 'rails', '~> 5.2.4.3' # Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0' # Use Puma as the app server @@ -24,11 +26,11 @@ gem 'jbuilder', '~> 2.5' gem 'activeadmin' gem 'devise' +gem 'auto_strip_attributes' gem 'bootstrap' gem 'jquery-rails' gem 'rack-canonical-host' gem 'recaptcha', require: 'recaptcha/rails' -gem 'auto_strip_attributes' gem 'scenic' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 6c93a91..d1e4b6c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,63 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.1.7) - actionpack (= 5.1.7) + actioncable (5.2.4.3) + actionpack (= 5.2.4.3) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.7) - actionview (= 5.1.7) - activesupport (= 5.1.7) - rack (~> 2.0) + actionpack (5.2.4.3) + actionview (= 5.2.4.3) + activesupport (= 5.2.4.3) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.7) - activesupport (= 5.1.7) + actionview (5.2.4.3) + activesupport (= 5.2.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activeadmin (1.2.1) - arbre (>= 1.1.1) - coffee-rails + activeadmin (2.7.0) + arbre (~> 1.2, >= 1.2.1) formtastic (~> 3.1) - formtastic_i18n + formtastic_i18n (~> 0.4) inherited_resources (~> 1.7) - jquery-rails (>= 4.2.0) - kaminari (>= 0.15, < 2.0) - railties (>= 4.2, < 5.2) - ransack (~> 1.3) - sass (~> 3.1) - sprockets (< 4.1) - activejob (5.1.7) - activesupport (= 5.1.7) + jquery-rails (~> 4.2) + kaminari (~> 1.0, >= 1.0.1) + railties (>= 5.2, < 6.1) + ransack (~> 2.1, >= 2.1.1) + sassc-rails (~> 2.1) + sprockets (>= 3.0, < 4.1) + activejob (5.2.4.3) + activesupport (= 5.2.4.3) globalid (>= 0.3.6) - activemodel (5.1.7) - activesupport (= 5.1.7) - activerecord (5.1.7) - activemodel (= 5.1.7) - activesupport (= 5.1.7) - arel (~> 8.0) - activesupport (5.1.7) + activemodel (5.2.4.3) + activesupport (= 5.2.4.3) + activerecord (5.2.4.3) + activemodel (= 5.2.4.3) + activesupport (= 5.2.4.3) + arel (>= 9.0) + activestorage (5.2.4.3) + actionpack (= 5.2.4.3) + activerecord (= 5.2.4.3) + marcel (~> 0.3.1) + activesupport (5.2.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) - arbre (1.1.1) + arbre (1.2.1) activesupport (>= 3.0.0) - arel (8.0.0) + arel (9.0.0) ast (2.4.0) auto_strip_attributes (2.4.0) activerecord (>= 4.0) @@ -77,13 +80,6 @@ GEM xpath (>= 2.0, < 4.0) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) - coffee-rails (4.2.2) - coffee-script (>= 2.2.0) - railties (>= 4.0.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) concurrent-ruby (1.1.6) crass (1.0.6) devise (4.7.1) @@ -94,26 +90,26 @@ GEM warden (~> 1.2.3) erubi (1.9.0) execjs (2.7.0) - ffi (1.10.0) + ffi (1.12.2) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) globalid (0.4.2) activesupport (>= 4.2.0) - has_scope (0.7.1) - actionpack (>= 4.1, < 5.2) - activesupport (>= 4.1, < 5.2) + has_scope (0.7.2) + actionpack (>= 4.1) + activesupport (>= 4.1) i18n (1.8.2) concurrent-ruby (~> 1.0) - inherited_resources (1.8.0) - actionpack (>= 4.2, <= 5.2) + inherited_resources (1.11.0) + actionpack (>= 5.0, < 6.1) has_scope (~> 0.6) - railties (>= 4.2, <= 5.2) - responders + railties (>= 5.0, < 6.1) + responders (>= 2, < 4) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) - jquery-rails (4.3.1) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -139,7 +135,10 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) method_source (1.0.0) + mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.1) @@ -148,14 +147,13 @@ GEM nokogiri (1.10.9) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - parallel (1.12.1) - parser (2.5.0.5) + parallel (1.19.1) + parser (2.7.1.3) ast (~> 2.4.0) pg (1.0.0) - polyamorous (1.3.3) - activerecord (>= 3.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) popper_js (1.14.5) - powerpack (0.1.1) public_suffix (3.0.2) puma (3.12.6) rack (2.2.2) @@ -164,56 +162,60 @@ GEM rack (>= 1.0.0, < 3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.1.7) - actioncable (= 5.1.7) - actionmailer (= 5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) - activemodel (= 5.1.7) - activerecord (= 5.1.7) - activesupport (= 5.1.7) + rails (5.2.4.3) + actioncable (= 5.2.4.3) + actionmailer (= 5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) + activemodel (= 5.2.4.3) + activerecord (= 5.2.4.3) + activestorage (= 5.2.4.3) + activesupport (= 5.2.4.3) bundler (>= 1.3.0) - railties (= 5.1.7) + railties (= 5.2.4.3) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.1.7) - actionpack (= 5.1.7) - activesupport (= 5.1.7) + railties (5.2.4.3) + actionpack (= 5.2.4.3) + activesupport (= 5.2.4.3) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rainbow (3.0.0) rake (13.0.1) - ransack (1.8.8) - actionpack (>= 3.0) - activerecord (>= 3.0) - activesupport (>= 3.0) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) i18n - polyamorous (~> 1.3.2) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + polyamorous (= 2.3.2) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) ffi (~> 1.0) recaptcha (4.7.0) json - responders (3.0.0) + responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - rubocop (0.54.0) + rexml (3.2.4) + rubocop (0.84.0) parallel (~> 1.10) - parser (>= 2.5) - powerpack (~> 0.1) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml + rubocop-ast (>= 0.0.3) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.9.0) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (0.0.3) + parser (>= 2.7.0.1) + ruby-progressbar (1.10.1) ruby_dep (1.5.0) rubyzip (1.3.0) - sass (3.7.3) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -258,7 +260,7 @@ GEM thread_safe (~> 0.1) uglifier (4.1.8) execjs (>= 0.3.0, < 3) - unicode-display_width (1.3.0) + unicode-display_width (1.7.0) warden (1.2.8) rack (>= 2.0.6) web-console (3.5.1) @@ -266,7 +268,7 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.6.5) + websocket-driver (0.7.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) xpath (3.0.0) @@ -288,7 +290,7 @@ DEPENDENCIES pg (>= 0.18, < 2.0) puma (~> 3.12) rack-canonical-host - rails (~> 5.1.7) + rails (~> 5.2.4.3) recaptcha rubocop sass-rails (~> 5.0) diff --git a/Rakefile b/Rakefile index e85f913..488c551 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. diff --git a/app/admin/admin_users.rb b/app/admin/admin_users.rb index fed0ec1..78e454e 100644 --- a/app/admin/admin_users.rb +++ b/app/admin/admin_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.register AdminUser do permit_params :email, :password, :password_confirmation diff --git a/app/admin/attendees.rb b/app/admin/attendees.rb index 1d2e1e3..8c7c872 100644 --- a/app/admin/attendees.rb +++ b/app/admin/attendees.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.register Attendee do scope :child? scope :diet? diff --git a/app/admin/dashboard.rb b/app/admin/dashboard.rb index 706695e..21064f9 100644 --- a/app/admin/dashboard.rb +++ b/app/admin/dashboard.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.register_page 'Dashboard' do menu priority: 1, label: proc { I18n.t('active_admin.dashboard') } diff --git a/app/admin/guests.rb b/app/admin/guests.rb index 1996eba..d44c309 100644 --- a/app/admin/guests.rb +++ b/app/admin/guests.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.register Guest do permit_params :email, :first_name, :last_name, :attending, :diet, :songs, :notes diff --git a/app/admin/plus_ones.rb b/app/admin/plus_ones.rb index 7108b02..6d51b2b 100644 --- a/app/admin/plus_ones.rb +++ b/app/admin/plus_ones.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.register PlusOne do permit_params :first_name, :last_name, :diet, :child diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1a55b5f..c3fda60 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base protect_from_forgery with: :exception diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index f1571a7..998d677 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GuestsController < ApplicationController def new respond_to :html diff --git a/app/controllers/plus_ones_controller.rb b/app/controllers/plus_ones_controller.rb index aaf5209..a67c91c 100644 --- a/app/controllers/plus_ones_controller.rb +++ b/app/controllers/plus_ones_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PlusOnesController < ApplicationController before_action do @guest = Guest.find_by_id_token(params[:guest_id]) @@ -41,7 +43,7 @@ class PlusOnesController < ApplicationController def destroy respond_to :html @plus_one = @guest.plus_ones.find_by(id: params[:id]) - @plus_one.destroy if @plus_one + @plus_one&.destroy redirect_to guest_plus_ones_path(@guest) end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index cfb1eae..c38f8c8 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WelcomeController < ApplicationController def index @google_maps_url = 'https://goo.gl/maps/nBAxNAsmPSS2' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c3736b3..1e35587 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationHelper def flash_class(key) case key @@ -10,6 +12,7 @@ module ApplicationHelper def errors_for(object) return unless object.errors.any? + content_tag(:div, class: 'mb-3 card border-danger') do concat(content_tag(:div, class: 'card-header bg-danger text-white') do concat "Oops, #{pluralize(object.errors.count, 'problem')}:" diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index 00317bf..10452d8 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module GuestsHelper end diff --git a/app/helpers/plus_ones_helper.rb b/app/helpers/plus_ones_helper.rb index f836a53..e9b538a 100644 --- a/app/helpers/plus_ones_helper.rb +++ b/app/helpers/plus_ones_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module PlusOnesHelper end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index eeead45..4ada0f4 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module WelcomeHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index a009ace..d92ffdd 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 286b223..d84cb6e 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/app/mailers/guest_mailer.rb b/app/mailers/guest_mailer.rb index 2056fdc..96eb525 100644 --- a/app/mailers/guest_mailer.rb +++ b/app/mailers/guest_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GuestMailer < ApplicationMailer default from: ENV['FROM_EMAIL'], reply_to: ENV['CONTACT_EMAIL'] diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index 4226312..a77517f 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # ActiveAdmin console user. # diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba..71fbba5 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/app/models/attendee.rb b/app/models/attendee.rb index 2893a57..e9c8acc 100644 --- a/app/models/attendee.rb +++ b/app/models/attendee.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # A guest or plus one. # diff --git a/app/models/concerns/findable_with_token.rb b/app/models/concerns/findable_with_token.rb index da5f07f..e33be74 100644 --- a/app/models/concerns/findable_with_token.rb +++ b/app/models/concerns/findable_with_token.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # # Make a model findable only when a secure token is provided. # module FindableWithToken extend ActiveSupport::Concern - ID_TOKEN_RX = /\A(\d+)-(\w+)\z/ + ID_TOKEN_RX = /\A(\d+)-(\w+)\z/.freeze included do has_secure_token @@ -15,12 +17,14 @@ module FindableWithToken def self.find_by_id_token(id_token) raise ActiveRecord::RecordNotFound unless id_token =~ ID_TOKEN_RX + id = Regexp.last_match(1) token = Regexp.last_match(2) record = find(id) raise ActiveRecord::RecordNotFound unless ActiveSupport::SecurityUtils.secure_compare(record.token, token) + record end end diff --git a/app/models/guest.rb b/app/models/guest.rb index 8c87705..cedc818 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # A primary guest. # @@ -26,6 +28,7 @@ class Guest < ApplicationRecord def email_safe_salutation return 'Hello,' if first_name.blank? || first_name !~ /\A[\p{Word}\s'-]{1,30}\z/i + "Dear #{first_name}," end diff --git a/app/models/plus_one.rb b/app/models/plus_one.rb index bfcd4a9..bbf4f61 100644 --- a/app/models/plus_one.rb +++ b/app/models/plus_one.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # An extra guest. # diff --git a/bin/bundle b/bin/bundle index 66e9889..f19acf5 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 5badb2f..0739660 100755 --- a/bin/rails +++ b/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index d87d5f5..1724048 100755 --- a/bin/rake +++ b/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index 78c4e86..94fd4d7 100755 --- a/bin/setup +++ b/bin/setup @@ -1,10 +1,9 @@ #!/usr/bin/env ruby -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -21,7 +20,6 @@ chdir APP_ROOT do # Install JavaScript dependencies if using Yarn # system('bin/yarn') - # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/update b/bin/update index a8e4462..58bfaed 100755 --- a/bin/update +++ b/bin/update @@ -1,10 +1,9 @@ #!/usr/bin/env ruby -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -18,6 +17,9 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + puts "\n== Updating database ==" system! 'bin/rails db:migrate' diff --git a/bin/yarn b/bin/yarn index c2bacef..460dd56 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,8 +1,8 @@ #!/usr/bin/env ruby -VENDOR_PATH = File.expand_path('..', __dir__) -Dir.chdir(VENDOR_PATH) do +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do begin - exec "yarnpkg #{ARGV.join(" ")}" + exec "yarnpkg", *ARGV rescue Errno::ENOENT $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" diff --git a/config.ru b/config.ru index 02dbfae..6a1dea3 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. require_relative 'config/environment' diff --git a/config/application.rb b/config/application.rb index 03f6dfa..e68c504 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative 'boot' require 'rails' @@ -5,6 +7,7 @@ require 'rails' require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' +require 'active_storage/engine' require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_view/railtie' @@ -22,7 +25,8 @@ module Wedding config.load_defaults 5.1 # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. end end diff --git a/config/boot.rb b/config/boot.rb index 30f5120..c04863f 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,6 @@ +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/environment.rb b/config/environment.rb index 426333b..d5abe55 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative 'application' diff --git a/config/environments/development.rb b/config/environments/development.rb index f8fa811..9a41767 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -13,12 +15,13 @@ Rails.application.configure do config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. - if Rails.root.join('tmp/caching-dev.txt').exist? + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -26,6 +29,9 @@ Rails.application.configure do config.cache_store = :null_store end + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -37,6 +43,9 @@ Rails.application.configure do # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. diff --git a/config/environments/production.rb b/config/environments/production.rb index 93648db..f971248 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -14,10 +16,9 @@ Rails.application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Attempt to read encrypted secrets from `config/secrets.yml.enc`. - # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or - # `config/secrets.yml.key`. - config.read_encrypted_secrets = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. @@ -39,6 +40,9 @@ Rails.application.configure do # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -55,6 +59,7 @@ Rails.application.configure do # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "wedding_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -67,18 +72,18 @@ Rails.application.configure do } config.action_mailer.smtp_settings = { - address: ENV['SMTP_ADDRESS'], - port: (ENV['SMTP_PORT'] || 587).to_i, - domain: ENV['SMTP_DOMAIN'], - user_name: ENV['SMTP_USER_NAME'], - password: ENV['SMTP_PASSWORD'], - authentication: ENV['SMTP_AUTHENTICATION'] || 'plain', + address: ENV['SMTP_ADDRESS'], + port: (ENV['SMTP_PORT'] || 587).to_i, + domain: ENV['SMTP_DOMAIN'], + user_name: ENV['SMTP_USER_NAME'], + password: ENV['SMTP_PASSWORD'], + authentication: ENV['SMTP_AUTHENTICATION'] || 'plain', enable_starttls_auto: ENV['SMTP_ENABLE_STARTTLS_AUTO'] || 'true' } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = [I18n.default_locale] + config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify diff --git a/config/environments/test.rb b/config/environments/test.rb index 514401e..e6078ba 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -15,7 +17,7 @@ Rails.application.configure do # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. @@ -27,6 +29,10 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index 7ac893c..6f83bb7 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ActiveAdmin.setup do |config| # == Site Title # diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 89d2efa..f4556db 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 295bf72..b5eff6f 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cd..d0f0d3b 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000..497f566 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 5a6a32d..ee8dff9 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1..7a4f47b 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..aa7435f 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc18996..6e1d16f 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 0000000..7df9ce8 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc396..2f3c0db 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/puma.rb b/config/puma.rb index ccda173..2f6d14e 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match @@ -15,6 +17,9 @@ port ENV.fetch('PORT') { 3000 } # environment ENV.fetch('RAILS_ENV') { 'development' } +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' } + # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together # the concurrency of the application would be max `threads` * `workers`. @@ -26,31 +31,9 @@ environment ENV.fetch('RAILS_ENV') { 'development' } # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code # before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. If you use this option -# you need to make sure to reconnect any threads in the `on_worker_boot` -# block. +# process behavior so workers use less memory. # # preload_app! -# If you are preloading your application and using Active Record, it's -# recommended that you close any connections to the database before workers -# are forked to prevent connection leakage. -# -# before_fork do -# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) -# end - -# The code in the `on_worker_boot` will be called if you are using -# clustered mode by specifying a number of `workers`. After each worker -# process is booted, this block will be run. If you are using the `preload_app!` -# option, you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, as Ruby -# cannot share connections between processes. -# -# on_worker_boot do -# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) -# end -# - # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb index 5d49e29..d54478a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) diff --git a/config/spring.rb b/config/spring.rb index 9fa7863..c5933e4 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[ .ruby-version .rbenv-vars diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..d32f76e --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/migrate/20180324193210_create_guests.rb b/db/migrate/20180324193210_create_guests.rb index d4fcfb3..9548909 100644 --- a/db/migrate/20180324193210_create_guests.rb +++ b/db/migrate/20180324193210_create_guests.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateGuests < ActiveRecord::Migration[5.1] def change create_table :guests do |t| diff --git a/db/migrate/20180324195736_create_active_admin_comments.rb b/db/migrate/20180324195736_create_active_admin_comments.rb index 8abb5e5..3188de4 100644 --- a/db/migrate/20180324195736_create_active_admin_comments.rb +++ b/db/migrate/20180324195736_create_active_admin_comments.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateActiveAdminComments < ActiveRecord::Migration::Current def self.up create_table :active_admin_comments do |t| diff --git a/db/migrate/20180325090310_add_guest_info.rb b/db/migrate/20180325090310_add_guest_info.rb index 9862d38..7377b5e 100644 --- a/db/migrate/20180325090310_add_guest_info.rb +++ b/db/migrate/20180325090310_add_guest_info.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddGuestInfo < ActiveRecord::Migration[5.1] def change enable_extension('citext') diff --git a/db/migrate/20180325135427_create_plus_ones.rb b/db/migrate/20180325135427_create_plus_ones.rb index 8d22cf6..6530541 100644 --- a/db/migrate/20180325135427_create_plus_ones.rb +++ b/db/migrate/20180325135427_create_plus_ones.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreatePlusOnes < ActiveRecord::Migration[5.1] def change create_table :plus_ones do |t| diff --git a/db/migrate/20180325202641_simplify_diet.rb b/db/migrate/20180325202641_simplify_diet.rb index 3e3cd28..fa28ea3 100644 --- a/db/migrate/20180325202641_simplify_diet.rb +++ b/db/migrate/20180325202641_simplify_diet.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SimplifyDiet < ActiveRecord::Migration[5.1] def change change_table :guests do |t| diff --git a/db/migrate/20180325212232_add_guest_notes.rb b/db/migrate/20180325212232_add_guest_notes.rb index 1544c9c..ae55ab6 100644 --- a/db/migrate/20180325212232_add_guest_notes.rb +++ b/db/migrate/20180325212232_add_guest_notes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddGuestNotes < ActiveRecord::Migration[5.1] def change change_table :guests do |t| diff --git a/db/migrate/20180329080019_add_first_name_last_name_to_guest.rb b/db/migrate/20180329080019_add_first_name_last_name_to_guest.rb index 73d1f8a..af65dad 100644 --- a/db/migrate/20180329080019_add_first_name_last_name_to_guest.rb +++ b/db/migrate/20180329080019_add_first_name_last_name_to_guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddFirstNameLastNameToGuest < ActiveRecord::Migration[5.1] def change change_table :guests do |t| diff --git a/db/migrate/20180329080718_add_first_name_last_name_to_plus_one.rb b/db/migrate/20180329080718_add_first_name_last_name_to_plus_one.rb index 4eb78c7..d4cc415 100644 --- a/db/migrate/20180329080718_add_first_name_last_name_to_plus_one.rb +++ b/db/migrate/20180329080718_add_first_name_last_name_to_plus_one.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddFirstNameLastNameToPlusOne < ActiveRecord::Migration[5.1] def change change_table :plus_ones do |t| diff --git a/db/migrate/20180329212947_add_confirmed_at_to_guests.rb b/db/migrate/20180329212947_add_confirmed_at_to_guests.rb index 2402f52..999c5da 100644 --- a/db/migrate/20180329212947_add_confirmed_at_to_guests.rb +++ b/db/migrate/20180329212947_add_confirmed_at_to_guests.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AddConfirmedAtToGuests < ActiveRecord::Migration[5.1] def change change_table :guests do |t| diff --git a/db/migrate/20180804103058_create_attendees.rb b/db/migrate/20180804103058_create_attendees.rb index 38b0e9e..91e7843 100644 --- a/db/migrate/20180804103058_create_attendees.rb +++ b/db/migrate/20180804103058_create_attendees.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CreateAttendees < ActiveRecord::Migration[5.1] def change create_view :attendees diff --git a/db/seeds.rb b/db/seeds.rb index d3f43ce..0c4eb95 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # diff --git a/lib/rack/x_robots_tag.rb b/lib/rack/x_robots_tag.rb index 9dba526..66d03d2 100644 --- a/lib/rack/x_robots_tag.rb +++ b/lib/rack/x_robots_tag.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Rack # # Set X-Robots-Tag header to ask search engines not to index us. diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index e8d8dfb..de31944 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class ApplicationSystemTestCase < ActionDispatch::SystemTestCase diff --git a/test/controllers/guests_controller_test.rb b/test/controllers/guests_controller_test.rb index f5b60bf..aa95f95 100644 --- a/test/controllers/guests_controller_test.rb +++ b/test/controllers/guests_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class GuestsControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/plus_ones_controller_test.rb b/test/controllers/plus_ones_controller_test.rb index 8d299b4..aa68330 100644 --- a/test/controllers/plus_ones_controller_test.rb +++ b/test/controllers/plus_ones_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class PlusOnesControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/welcome_controller_test.rb b/test/controllers/welcome_controller_test.rb index d43612b..85201e4 100644 --- a/test/controllers/welcome_controller_test.rb +++ b/test/controllers/welcome_controller_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class WelcomeControllerTest < ActionDispatch::IntegrationTest diff --git a/test/mailers/guest_mailer_test.rb b/test/mailers/guest_mailer_test.rb index 80e11dd..b8369c8 100644 --- a/test/mailers/guest_mailer_test.rb +++ b/test/mailers/guest_mailer_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class GuestMailerTest < ActionMailer::TestCase diff --git a/test/mailers/previews/guest_mailer_preview.rb b/test/mailers/previews/guest_mailer_preview.rb index 443dce7..516911f 100644 --- a/test/mailers/previews/guest_mailer_preview.rb +++ b/test/mailers/previews/guest_mailer_preview.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Preview all emails at http://localhost:3000/rails/mailers/guest_mailer class GuestMailerPreview < ActionMailer::Preview def confirmation_email_attending diff --git a/test/models/admin_user_test.rb b/test/models/admin_user_test.rb index 6215c04..81a20b4 100644 --- a/test/models/admin_user_test.rb +++ b/test/models/admin_user_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class AdminUserTest < ActiveSupport::TestCase diff --git a/test/models/attendee_test.rb b/test/models/attendee_test.rb index 163e393..ac47922 100644 --- a/test/models/attendee_test.rb +++ b/test/models/attendee_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class AttendeeTest < ActiveSupport::TestCase diff --git a/test/models/guest_test.rb b/test/models/guest_test.rb index 24224bb..fb61f19 100644 --- a/test/models/guest_test.rb +++ b/test/models/guest_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class GuestTest < ActiveSupport::TestCase diff --git a/test/models/plus_one_test.rb b/test/models/plus_one_test.rb index f026094..9a29e75 100644 --- a/test/models/plus_one_test.rb +++ b/test/models/plus_one_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'test_helper' class PlusOneTest < ActiveSupport::TestCase diff --git a/test/system/rsvp_happy_path_test.rb b/test/system/rsvp_happy_path_test.rb index c05c130..5b9b1d0 100644 --- a/test/system/rsvp_happy_path_test.rb +++ b/test/system/rsvp_happy_path_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'application_system_test_case' class RsvpHappyPathTest < ApplicationSystemTestCase diff --git a/test/test_helper.rb b/test/test_helper.rb index 88d8f43..039f9fd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) require 'rails/test_help'