diff --git a/Gemfile b/Gemfile index 27aa1cd5069..af71a1b9426 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'hiredis' gem 'http_accept_language' gem 'identity-doc-auth', github: '18F/identity-doc-auth', tag: 'v0.3.0' gem 'identity-hostdata', github: '18F/identity-hostdata', tag: 'v0.4.1' -require File.join(__dir__, 'app', 'services', 'lambda_jobs', 'git_ref.rb') +require File.join(__dir__, 'lib', 'lambda_jobs', 'git_ref.rb') gem 'identity-idp-functions', github: '18F/identity-idp-functions', ref: LambdaJobs::GIT_REF gem 'identity-telephony', github: '18f/identity-telephony', tag: 'v0.1.6' gem 'identity_validations', github: '18F/identity-validations', branch: 'master' diff --git a/app/services/db/proofing_component/proofing_component_summary.rb b/app/services/db/proofing_component/proofing_component_summary.rb index 27110494f4b..ca9ea13664e 100644 --- a/app/services/db/proofing_component/proofing_component_summary.rb +++ b/app/services/db/proofing_component/proofing_component_summary.rb @@ -1,6 +1,6 @@ module Db module ProofingComponent - class ProofingComponentsSummary + class ProofingComponentSummary SKIP_FIELDS = %w[id user_id created_at updated_at].freeze def call diff --git a/bin/rails b/bin/rails index 5191e6927af..07396602377 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/config/application.rb b/config/application.rb index b67a9b35881..28382b017da 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' require_relative '../lib/upaya_log_formatter' require_relative '../lib/app_config' diff --git a/config/environment.rb b/config/environment.rb index ee8d90dc651..426333bb469 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 28db34a773e..542918abd59 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -5,7 +5,6 @@ config.cache_classes = false config.eager_load = false config.consider_all_requests_local = true - config.action_controller.perform_caching = false config.active_support.deprecation = :log config.active_record.migration_error = :page_load config.assets.debug = true @@ -24,6 +23,20 @@ config.lograge.ignore_actions = ['Users::SessionsController#active'] config.lograge.formatter = Lograge::Formatters::Json.new + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}", + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + # Override log formatter config.log_formatter = Upaya::DevelopmentUpayaLogFormatter.new diff --git a/config/environments/test.rb b/config/environments/test.rb index d82772b395d..915dc344093 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,11 +1,13 @@ Rails.application.configure do config.active_job.queue_adapter = :test - config.cache_classes = true + config.cache_classes = false + config.action_view.cache_template_loading = true config.eager_load = false config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.cache_store = :null_store config.action_dispatch.show_exceptions = false config.action_controller.allow_forgery_protection = false config.active_support.test_order = :random diff --git a/development.Dockerfile b/development.Dockerfile index c5e88bb02b4..ffd06435eb4 100644 --- a/development.Dockerfile +++ b/development.Dockerfile @@ -9,7 +9,7 @@ ENV MAKEFLAGS "-j$(nproc)" # Install dev and test gems COPY Gemfile Gemfile.lock ./ -COPY app/services/lambda_jobs/git_ref.rb ./app/services/lambda_jobs/ +COPY lib/lambda_jobs/git_ref.rb ./lib/lambda_jobs/ RUN bundle install -j $(nproc) --system --with development test # Install NPM packages diff --git a/app/services/lambda_jobs/git_ref.rb b/lib/lambda_jobs/git_ref.rb similarity index 100% rename from app/services/lambda_jobs/git_ref.rb rename to lib/lambda_jobs/git_ref.rb diff --git a/spec/controllers/twilio_voice_controller_spec.rb b/spec/controllers/twilio_voice_controller_spec.rb index 0e78c366db0..510da2bdd43 100644 --- a/spec/controllers/twilio_voice_controller_spec.rb +++ b/spec/controllers/twilio_voice_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe Telephony::Twilio::TwilioVoiceController do +describe TwilioVoiceController do describe '#show' do context 'with nothing in the params' do it 'renders an error' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 482d56965ad..8fa5945eabc 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -10,7 +10,7 @@ # this is loaded super early by the Gemfile so it gets ignored by SimpleCov # and sinks our coverage reports, so we ignore it - add_filter '/app/services/lambda_jobs/git_ref.rb' + add_filter '/lib/lambda_jobs/git_ref.rb' end end