From 8627bb79ddf572398452deaf2a0ff6c65008c9b1 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:10:51 +0100 Subject: [PATCH] rubocop -A --- Appraisals | 2 + Gemfile | 2 + Rakefile | 2 + bin/console | 1 + exe/generate_edges | 1 + lib/rails_edge_test.rb | 2 + lib/rails_edge_test/configuration.rb | 14 +- lib/rails_edge_test/dsl.rb | 2 + lib/rails_edge_test/dsl/action.rb | 78 +++---- lib/rails_edge_test/dsl/controller.rb | 44 ++-- lib/rails_edge_test/dsl/edge.rb | 202 +++++++++--------- lib/rails_edge_test/dsl/let_handler.rb | 30 +-- lib/rails_edge_test/printers/boring.rb | 52 ++--- lib/rails_edge_test/printers/silent.rb | 24 ++- lib/rails_edge_test/printers/tree.rb | 80 +++---- lib/rails_edge_test/runner.rb | 2 + lib/rails_edge_test/version.rb | 2 + rails_edge_test.gemspec | 2 + spec/rails_edge_test/configuration_spec.rb | 2 + spec/rails_edge_test/dsl/edge_spec.rb | 8 +- spec/rails_edge_test/dsl/let_handler_spec.rb | 4 +- spec/rails_edge_test/dsl_spec.rb | 2 + spec/rails_edge_test/runner_spec.rb | 2 + spec/rails_edge_test_spec.rb | 2 + spec/rails_helper.rb | 2 + spec/spec_helper.rb | 2 + spec/support/test_app/Gemfile | 2 + spec/support/test_app/Rakefile | 2 + .../app/controllers/application_controller.rb | 2 + spec/support/test_app/bin/bundle | 2 + spec/support/test_app/bin/rails | 2 + spec/support/test_app/bin/rake | 2 + spec/support/test_app/bin/setup | 2 + spec/support/test_app/bin/spring | 1 + spec/support/test_app/config.ru | 2 + spec/support/test_app/config/application.rb | 2 + spec/support/test_app/config/boot.rb | 2 + spec/support/test_app/config/environment.rb | 2 + .../config/environments/development.rb | 2 + .../config/environments/production.rb | 2 + .../test_app/config/environments/test.rb | 2 + .../initializers/backtrace_silencers.rb | 2 + .../config/initializers/cookies_serializer.rb | 2 + .../initializers/filter_parameter_logging.rb | 2 + .../config/initializers/inflections.rb | 2 + .../config/initializers/mime_types.rb | 2 + .../config/initializers/session_store.rb | 2 + .../to_time_preserves_timezone.rb | 2 + .../config/initializers/wrap_parameters.rb | 2 + spec/support/test_app/config/routes.rb | 2 + spec/support/test_app/db/seeds.rb | 2 + spec/support/test_app/edge/another_edge.rb | 2 + spec/support/test_app/edge/example_edge.rb | 2 + 53 files changed, 365 insertions(+), 254 deletions(-) diff --git a/Appraisals b/Appraisals index 111e0bc..5fc4f3f 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,5 @@ +# frozen_string_literal: true + appraise 'rails-5.2' do gem 'rails', '~> 5.2.0' end diff --git a/Gemfile b/Gemfile index 3c85da8..16009c1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in rails_edge_test.gemspec diff --git a/Rakefile b/Rakefile index 4c774a2..82bb534 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'bundler/gem_tasks' require 'rspec/core/rake_task' diff --git a/bin/console b/bin/console index 19e1532..8c0f358 100755 --- a/bin/console +++ b/bin/console @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'bundler/setup' require 'rails_edge_test' diff --git a/exe/generate_edges b/exe/generate_edges index e233401..cf63fc5 100755 --- a/exe/generate_edges +++ b/exe/generate_edges @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'open3' require 'rails_edge_test' diff --git a/lib/rails_edge_test.rb b/lib/rails_edge_test.rb index 9bf9fca..c3ec65a 100644 --- a/lib/rails_edge_test.rb +++ b/lib/rails_edge_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_edge_test/version' require 'rails_edge_test/dsl' require 'rails_edge_test/dsl/controller' diff --git a/lib/rails_edge_test/configuration.rb b/lib/rails_edge_test/configuration.rb index 5947d32..646450e 100644 --- a/lib/rails_edge_test/configuration.rb +++ b/lib/rails_edge_test/configuration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest class Configuration attr_accessor :elm_path, :edge_root_path, :printer @@ -35,23 +37,17 @@ def after_each(&block) end def wrap_suite_execution(&block) - @before_suite_blocks.each do |before_suit_block| - before_suit_block.call - end + @before_suite_blocks.each(&:call) block.call end def wrap_edge_execution(&edge) - @before_each_blocks.each do |before_each_block| - before_each_block.call - end + @before_each_blocks.each(&:call) edge.call - @after_each_blocks.each do |after_each_block| - after_each_block.call - end + @after_each_blocks.each(&:call) end end end diff --git a/lib/rails_edge_test/dsl.rb b/lib/rails_edge_test/dsl.rb index b2e6380..0a2a14c 100644 --- a/lib/rails_edge_test/dsl.rb +++ b/lib/rails_edge_test/dsl.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest module Dsl def controller(controller_class, &) diff --git a/lib/rails_edge_test/dsl/action.rb b/lib/rails_edge_test/dsl/action.rb index f91d3cd..a673605 100644 --- a/lib/rails_edge_test/dsl/action.rb +++ b/lib/rails_edge_test/dsl/action.rb @@ -1,49 +1,53 @@ -module RailsEdgeTest::Dsl - Action = Struct.new(:name, :controller) do - def initialize(*args) - super - @edges = {} - @let_handler = LetHandler.new - end +# frozen_string_literal: true - def edge(description, &block) - edge = Edge.new(description, self) - @edges[edge] = block - end +module RailsEdgeTest + module Dsl + Action = Struct.new(:name, :controller) do + def initialize(*args) + super + @edges = {} + @let_handler = LetHandler.new + end - def let(title, &block) - @let_handler.add_definition(title, &block) - end + def edge(description, &block) + edge = Edge.new(description, self) + @edges[edge] = block + end - def generate(title, &block) - @let_handler.add_definition("generate_#{title}", &block) - end + def let(title, &block) + @let_handler.add_definition(title, &block) + end - def __edges - @edges - end + def generate(title, &block) + @let_handler.add_definition("generate_#{title}", &block) + end - def __let_handler - @let_handler - end + def __edges + @edges + end - def controller_class - controller.controller_class - end + def __let_handler + @let_handler + end - # support calling methods defined in controller - def method_missing(method_name, ...) - if controller.respond_to?(method_name) - controller.public_send(method_name, ...) - else - super + def controller_class + controller.controller_class + end + + # support calling methods defined in controller + def method_missing(method_name, ...) + if controller.respond_to?(method_name) + controller.public_send(method_name, ...) + else + super + end end - end - # always define respond_to_missing? when defining method_missing: - # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding - def respond_to_missing?(method_name, include_private = false) - controller.respond_to?(method_name) || super + # always define respond_to_missing? when defining method_missing: + # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding + def respond_to_missing?(method_name, include_private = false) + controller.respond_to?(method_name) || super + end end end end diff --git a/lib/rails_edge_test/dsl/controller.rb b/lib/rails_edge_test/dsl/controller.rb index 0049583..f173a62 100644 --- a/lib/rails_edge_test/dsl/controller.rb +++ b/lib/rails_edge_test/dsl/controller.rb @@ -1,27 +1,31 @@ -module RailsEdgeTest::Dsl - Controller = Struct.new(:controller_class) do - def initialize(*args) - super - @actions = [] - @let_handler = LetHandler.new - end +# frozen_string_literal: true - def action(name, &block) - new_action = Action.new(name, self) - new_action.instance_exec(&block) - @actions << new_action - end +module RailsEdgeTest + module Dsl + Controller = Struct.new(:controller_class) do + def initialize(*args) + super + @actions = [] + @let_handler = LetHandler.new + end - def let(title, &block) - @let_handler.add_definition(title, &block) - end + def action(name, &block) + new_action = Action.new(name, self) + new_action.instance_exec(&block) + @actions << new_action + end - def __actions - @actions - end + def let(title, &block) + @let_handler.add_definition(title, &block) + end + + def __actions + @actions + end - def __let_handler - @let_handler + def __let_handler + @let_handler + end end end end diff --git a/lib/rails_edge_test/dsl/edge.rb b/lib/rails_edge_test/dsl/edge.rb index 9517474..9aa0000 100644 --- a/lib/rails_edge_test/dsl/edge.rb +++ b/lib/rails_edge_test/dsl/edge.rb @@ -1,131 +1,135 @@ +# frozen_string_literal: true + require 'action_dispatch' require 'action_controller' require 'action_controller/test_case' -module RailsEdgeTest::Dsl - Edge = Struct.new(:description, :action) do - def initialize(*args) - super - @let_cache = {} - end - - delegate :controller_class, to: :action - delegate :session, to: :request - - def request - @request ||= ActionController::TestRequest.create(controller_class) - end - - # In the context of the edge, we want `controller` to be the rails controller - # instead of our own RailsEdgeTest::Dsl::Controller. In this way the user can - # directly access the rails controller within their edge. - def controller - @controller ||= controller_class.new - end +module RailsEdgeTest + module Dsl + Edge = Struct.new(:description, :action) do + def initialize(*args) + super + @let_cache = {} + end - def response - @response - end + delegate :controller_class, to: :action + delegate :session, to: :request - def perform_get(parameters = {}) - process(parameters) - end + def request + @request ||= ActionController::TestRequest.create(controller_class) + end - def perform_post(parameters = {}) - request.instance_variable_set(:@method, 'POST') - request.env['REQUEST_METHOD'] = 'POST' - process(parameters) - end + # In the context of the edge, we want `controller` to be the rails controller + # instead of our own RailsEdgeTest::Dsl::Controller. In this way the user can + # directly access the rails controller within their edge. + def controller + @controller ||= controller_class.new + end - def process(parameters = {}) - request.assign_parameters( - ::Rails.application.routes, - controller_class.controller_path, - action.name.to_s, - parameters.stringify_keys!, - '', - '' - ) - - response = ActionDispatch::Response.new.tap do |res| - res.request = request + def response + @response end - @response = controller.dispatch(action.name, request, response) - end + def perform_get(parameters = {}) + process(parameters) + end - def produce_elm_file(module_name, ivar: nil) - json = produce_json(ivar: ivar) - json = json.gsub('\\', '\\\\\\\\') # unbelievably, this replaces \ with \\ + def perform_post(parameters = {}) + request.instance_variable_set(:@method, 'POST') + request.env['REQUEST_METHOD'] = 'POST' + process(parameters) + end - filepath = File.join( - RailsEdgeTest.configuration.elm_path, - 'Edge', - controller_class.name.gsub('::', '/') - ) + def process(parameters = {}) + request.assign_parameters( + ::Rails.application.routes, + controller_class.controller_path, + action.name.to_s, + parameters.stringify_keys!, + '', + '' + ) + + response = ActionDispatch::Response.new.tap do |res| + res.request = request + end + + @response = controller.dispatch(action.name, request, response) + end - full_module_name = - "#{controller_class.name.gsub('::', '.')}.#{module_name}" + def produce_elm_file(module_name, ivar: nil) + json = produce_json(ivar: ivar) + json = json.gsub('\\', '\\\\\\\\') # unbelievably, this replaces \ with \\ - data = <<~ELM - module Edge.#{full_module_name} exposing (json) + filepath = File.join( + RailsEdgeTest.configuration.elm_path, + 'Edge', + controller_class.name.gsub('::', '/') + ) + full_module_name = + "#{controller_class.name.gsub('::', '.')}.#{module_name}" - json : String - json = - """ - #{json} - """ - ELM + data = <<~ELM + module Edge.#{full_module_name} exposing (json) - write_file(filepath, module_name + '.elm', data) - end - private + json : String + json = + """ + #{json} + """ + ELM - def produce_json(ivar: nil) - unless response - raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' + write_file(filepath, "#{module_name}.elm", data) end - raise 'Request did not result in a successful (2xx) response!' if response.is_a?(Array) && response[0] >= 300 - - ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false - if ivar - value = controller.send(:instance_variable_get, ivar) - JSON.pretty_unparse(value.as_json) - elsif response[1]['Content-Type']&.starts_with?('application/json') - value = JSON.parse(response[2].body) - JSON.pretty_unparse(value) - else - response[2].body + private + + def produce_json(ivar: nil) + unless response + raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' + end + + raise 'Request did not result in a successful (2xx) response!' if response.is_a?(Array) && response[0] >= 300 + + ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false + if ivar + value = controller.send(:instance_variable_get, ivar) + JSON.pretty_unparse(value.as_json) + elsif response[1]['Content-Type']&.starts_with?('application/json') + value = JSON.parse(response[2].body) + JSON.pretty_unparse(value) + else + response[2].body + end end - end - def write_file(filepath, filename, data) - FileUtils.mkdir_p(filepath) + def write_file(filepath, filename, data) + FileUtils.mkdir_p(filepath) - filepath = File.join(filepath, filename) + filepath = File.join(filepath, filename) - File.open(filepath, 'w') do |f| - f.write(data) - f.flush + File.open(filepath, 'w') do |f| + f.write(data) + f.flush + end end - end - # support calling methods defined in action - def method_missing(method_name, ...) - if action.respond_to?(method_name) - action.public_send(method_name, ...) - else - super + # support calling methods defined in action + def method_missing(method_name, ...) + if action.respond_to?(method_name) + action.public_send(method_name, ...) + else + super + end end - end - # always define respond_to_missing? when defining method_missing: - # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding - def respond_to_missing?(method_name, include_private = false) - action.respond_to?(method_name) || super + # always define respond_to_missing? when defining method_missing: + # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding + def respond_to_missing?(method_name, include_private = false) + action.respond_to?(method_name) || super + end end end end diff --git a/lib/rails_edge_test/dsl/let_handler.rb b/lib/rails_edge_test/dsl/let_handler.rb index 392c443..c318662 100644 --- a/lib/rails_edge_test/dsl/let_handler.rb +++ b/lib/rails_edge_test/dsl/let_handler.rb @@ -1,20 +1,24 @@ -module RailsEdgeTest::Dsl - class LetHandler - attr_reader :let_blocks +# frozen_string_literal: true - def initialize - @let_blocks = {} - end +module RailsEdgeTest + module Dsl + class LetHandler + attr_reader :let_blocks - def add_definition(title, &block) - @let_blocks[title] = block - end + def initialize + @let_blocks = {} + end + + def add_definition(title, &block) + @let_blocks[title] = block + end - def execute(title) - block = @let_blocks[title] - raise NoMethodError, "no method or let block defined with name #{title}" unless block + def execute(title) + block = @let_blocks[title] + raise NoMethodError, "no method or let block defined with name #{title}" unless block - block.call + block.call + end end end end diff --git a/lib/rails_edge_test/printers/boring.rb b/lib/rails_edge_test/printers/boring.rb index 60d07f8..cf99c78 100644 --- a/lib/rails_edge_test/printers/boring.rb +++ b/lib/rails_edge_test/printers/boring.rb @@ -1,35 +1,39 @@ -module RailsEdgeTest::Printers - class Boring - def initialize - @count = 0 - end +# frozen_string_literal: true - def begin_suite - puts '' - end +module RailsEdgeTest + module Printers + class Boring + def initialize + @count = 0 + end - def end_suite - puts "\n#{@count} edge specs executed." - end + def begin_suite + puts '' + end - def begin_controller(_controller) - print '.' - end + def end_suite + puts "\n#{@count} edge specs executed." + end - def end_controller; end + def begin_controller(_controller) + print '.' + end - def begin_action(_action) - print '.' - end + def end_controller; end - def end_action; end + def begin_action(_action) + print '.' + end - def begin_edge(_edge) - print '.' - end + def end_action; end + + def begin_edge(_edge) + print '.' + end - def end_edge - @count += 1 + def end_edge + @count += 1 + end end end end diff --git a/lib/rails_edge_test/printers/silent.rb b/lib/rails_edge_test/printers/silent.rb index d0f80db..5ca2e91 100644 --- a/lib/rails_edge_test/printers/silent.rb +++ b/lib/rails_edge_test/printers/silent.rb @@ -1,19 +1,23 @@ -module RailsEdgeTest::Printers - class Silent - def begin_suite; end +# frozen_string_literal: true - def end_suite; end +module RailsEdgeTest + module Printers + class Silent + def begin_suite; end - def begin_controller(_controller); end + def end_suite; end - def end_controller; end + def begin_controller(_controller); end - def begin_action(_action); end + def end_controller; end - def end_action; end + def begin_action(_action); end - def begin_edge(_edge); end + def end_action; end - def end_edge; end + def begin_edge(_edge); end + + def end_edge; end + end end end diff --git a/lib/rails_edge_test/printers/tree.rb b/lib/rails_edge_test/printers/tree.rb index 7f0585c..ecdbb41 100644 --- a/lib/rails_edge_test/printers/tree.rb +++ b/lib/rails_edge_test/printers/tree.rb @@ -1,41 +1,45 @@ -module RailsEdgeTest::Printers - class Tree - def initialize - @count = 0 - end - - def begin_suite - puts '' - puts 'Generating Edges...' - puts '-------------------' - puts '' - end - - def end_suite - puts "\n#{@count} edge specs executed." - end - - def begin_controller(controller) - puts controller.controller_class.name - end - - def end_controller - puts '' - end - - def begin_action(action) - puts " #{action.name}" - end - - def end_action; end - - def begin_edge(edge) - print " #{edge.description}" - end - - def end_edge - puts ' ... done' - @count += 1 +# frozen_string_literal: true + +module RailsEdgeTest + module Printers + class Tree + def initialize + @count = 0 + end + + def begin_suite + puts '' + puts 'Generating Edges...' + puts '-------------------' + puts '' + end + + def end_suite + puts "\n#{@count} edge specs executed." + end + + def begin_controller(controller) + puts controller.controller_class.name + end + + def end_controller + puts '' + end + + def begin_action(action) + puts " #{action.name}" + end + + def end_action; end + + def begin_edge(edge) + print " #{edge.description}" + end + + def end_edge + puts ' ... done' + @count += 1 + end end end end diff --git a/lib/rails_edge_test/runner.rb b/lib/rails_edge_test/runner.rb index bfc5775..b037623 100644 --- a/lib/rails_edge_test/runner.rb +++ b/lib/rails_edge_test/runner.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest module Runner module_function diff --git a/lib/rails_edge_test/version.rb b/lib/rails_edge_test/version.rb index 6752a3b..6659771 100644 --- a/lib/rails_edge_test/version.rb +++ b/lib/rails_edge_test/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest VERSION = '2.0.0' end diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index c0d37a5..ef03b22 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_edge_test/version' diff --git a/spec/rails_edge_test/configuration_spec.rb b/spec/rails_edge_test/configuration_spec.rb index bd59b82..e99514c 100644 --- a/spec/rails_edge_test/configuration_spec.rb +++ b/spec/rails_edge_test/configuration_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' module Namespace diff --git a/spec/rails_edge_test/dsl/edge_spec.rb b/spec/rails_edge_test/dsl/edge_spec.rb index ef12c0b..1277f35 100644 --- a/spec/rails_edge_test/dsl/edge_spec.rb +++ b/spec/rails_edge_test/dsl/edge_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' module Namespace @@ -65,7 +67,7 @@ class EdgeController2 < EdgeController File.join( elm_path, 'Edge/Namespace/EdgeController/', - module_name + '.elm' + "#{module_name}.elm" ) end let(:module_name) { 'MyResponse' } @@ -253,7 +255,7 @@ def christina controller Namespace::EdgeController do action :simple do def christina(what, &block) - block.call(what) if block + block&.call(what) "#{what} in a bottle" end @@ -426,7 +428,7 @@ def christina end action :first do - let(:christie) { christina + ' and a lamp' } + let(:christie) { "#{christina} and a lamp" } edge 'call method' do test_value = christie diff --git a/spec/rails_edge_test/dsl/let_handler_spec.rb b/spec/rails_edge_test/dsl/let_handler_spec.rb index d2e31f7..c0cac2b 100644 --- a/spec/rails_edge_test/dsl/let_handler_spec.rb +++ b/spec/rails_edge_test/dsl/let_handler_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' class LetHandlerController < ActionController::Base @@ -195,7 +197,7 @@ def simple controller LetHandlerController do let(:christina) { 'genie in a bottle' } action :first do - let(:christie) { christina + ' and a lamp' } + let(:christie) { "#{christina} and a lamp" } edge 'call let' do test_value = christie end diff --git a/spec/rails_edge_test/dsl_spec.rb b/spec/rails_edge_test/dsl_spec.rb index 53db772..9eeaa1c 100644 --- a/spec/rails_edge_test/dsl_spec.rb +++ b/spec/rails_edge_test/dsl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' class MyController < ActionController::Base diff --git a/spec/rails_edge_test/runner_spec.rb b/spec/rails_edge_test/runner_spec.rb index 4f5b812..1ef6bdd 100644 --- a/spec/rails_edge_test/runner_spec.rb +++ b/spec/rails_edge_test/runner_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe RailsEdgeTest::Runner do diff --git a/spec/rails_edge_test_spec.rb b/spec/rails_edge_test_spec.rb index c7eeca6..9a6af73 100644 --- a/spec/rails_edge_test_spec.rb +++ b/spec/rails_edge_test_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe RailsEdgeTest do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e73bbf5..1b8ac86 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file (and the related Rails app) constructed with the help of # https://stackoverflow.com/a/33929321 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 31c606e..57db00d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'bundler/setup' require 'rails_edge_test' diff --git a/spec/support/test_app/Gemfile b/spec/support/test_app/Gemfile index b5e36ed..11143f2 100644 --- a/spec/support/test_app/Gemfile +++ b/spec/support/test_app/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' diff --git a/spec/support/test_app/Rakefile b/spec/support/test_app/Rakefile index f7a26dd..e51cf0e 100644 --- a/spec/support/test_app/Rakefile +++ b/spec/support/test_app/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/spec/support/test_app/app/controllers/application_controller.rb b/spec/support/test_app/app/controllers/application_controller.rb index 88558ae..a16321e 100644 --- a/spec/support/test_app/app/controllers/application_controller.rb +++ b/spec/support/test_app/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. diff --git a/spec/support/test_app/bin/bundle b/spec/support/test_app/bin/bundle index f19acf5..2dbb717 100755 --- a/spec/support/test_app/bin/bundle +++ b/spec/support/test_app/bin/bundle @@ -1,3 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/spec/support/test_app/bin/rails b/spec/support/test_app/bin/rails index 7a8ff81..3504c3f 100755 --- a/spec/support/test_app/bin/rails +++ b/spec/support/test_app/bin/rails @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + begin load File.expand_path('spring', __dir__) rescue LoadError => e diff --git a/spec/support/test_app/bin/rake b/spec/support/test_app/bin/rake index 0ba8c48..1fe6cf0 100755 --- a/spec/support/test_app/bin/rake +++ b/spec/support/test_app/bin/rake @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + begin load File.expand_path('spring', __dir__) rescue LoadError => e diff --git a/spec/support/test_app/bin/setup b/spec/support/test_app/bin/setup index 6942b15..0a3b26f 100755 --- a/spec/support/test_app/bin/setup +++ b/spec/support/test_app/bin/setup @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require 'pathname' # path to your application root. diff --git a/spec/support/test_app/bin/spring b/spec/support/test_app/bin/spring index 991bd4e..9bd27ec 100755 --- a/spec/support/test_app/bin/spring +++ b/spec/support/test_app/bin/spring @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # This file loads spring without using Bundler, in order to be fast. # It gets overwritten when you run the `spring binstub` command. diff --git a/spec/support/test_app/config.ru b/spec/support/test_app/config.ru index 81559b8..afd13e2 100644 --- a/spec/support/test_app/config.ru +++ b/spec/support/test_app/config.ru @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. require File.expand_path('config/environment', __dir__) diff --git a/spec/support/test_app/config/application.rb b/spec/support/test_app/config/application.rb index 2dab606..4b42719 100644 --- a/spec/support/test_app/config/application.rb +++ b/spec/support/test_app/config/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require File.expand_path('boot', __dir__) require 'rails/all' diff --git a/spec/support/test_app/config/boot.rb b/spec/support/test_app/config/boot.rb index 30f5120..30e594e 100644 --- a/spec/support/test_app/config/boot.rb +++ b/spec/support/test_app/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/spec/support/test_app/config/environment.rb b/spec/support/test_app/config/environment.rb index 0b8bdd8..32d57aa 100644 --- a/spec/support/test_app/config/environment.rb +++ b/spec/support/test_app/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require File.expand_path('application', __dir__) diff --git a/spec/support/test_app/config/environments/development.rb b/spec/support/test_app/config/environments/development.rb index b55e214..b67a201 100644 --- a/spec/support/test_app/config/environments/development.rb +++ b/spec/support/test_app/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. diff --git a/spec/support/test_app/config/environments/production.rb b/spec/support/test_app/config/environments/production.rb index 9ae9dd2..254b7c2 100644 --- a/spec/support/test_app/config/environments/production.rb +++ b/spec/support/test_app/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. diff --git a/spec/support/test_app/config/environments/test.rb b/spec/support/test_app/config/environments/test.rb index 1c19f08..2e26201 100644 --- a/spec/support/test_app/config/environments/test.rb +++ b/spec/support/test_app/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. diff --git a/spec/support/test_app/config/initializers/backtrace_silencers.rb b/spec/support/test_app/config/initializers/backtrace_silencers.rb index 59385cd..4b63f28 100644 --- a/spec/support/test_app/config/initializers/backtrace_silencers.rb +++ b/spec/support/test_app/config/initializers/backtrace_silencers.rb @@ -1,3 +1,5 @@ +# 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/spec/support/test_app/config/initializers/cookies_serializer.rb b/spec/support/test_app/config/initializers/cookies_serializer.rb index 7f70458..0a23b25 100644 --- a/spec/support/test_app/config/initializers/cookies_serializer.rb +++ b/spec/support/test_app/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/spec/support/test_app/config/initializers/filter_parameter_logging.rb b/spec/support/test_app/config/initializers/filter_parameter_logging.rb index 4a994e1..7a4f47b 100644 --- a/spec/support/test_app/config/initializers/filter_parameter_logging.rb +++ b/spec/support/test_app/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/spec/support/test_app/config/initializers/inflections.rb b/spec/support/test_app/config/initializers/inflections.rb index ac033bf..dc84742 100644 --- a/spec/support/test_app/config/initializers/inflections.rb +++ b/spec/support/test_app/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# 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/spec/support/test_app/config/initializers/mime_types.rb b/spec/support/test_app/config/initializers/mime_types.rb index dc18996..be6fedc 100644 --- a/spec/support/test_app/config/initializers/mime_types.rb +++ b/spec/support/test_app/config/initializers/mime_types.rb @@ -1,3 +1,5 @@ +# 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/spec/support/test_app/config/initializers/session_store.rb b/spec/support/test_app/config/initializers/session_store.rb index 438994f..751554c 100644 --- a/spec/support/test_app/config/initializers/session_store.rb +++ b/spec/support/test_app/config/initializers/session_store.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_test_app_session' diff --git a/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb b/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb index 8674be3..e1e6c75 100644 --- a/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb +++ b/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Preserve the timezone of the receiver when calling to `to_time`. diff --git a/spec/support/test_app/config/initializers/wrap_parameters.rb b/spec/support/test_app/config/initializers/wrap_parameters.rb index 33725e9..246168a 100644 --- a/spec/support/test_app/config/initializers/wrap_parameters.rb +++ b/spec/support/test_app/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/spec/support/test_app/config/routes.rb b/spec/support/test_app/config/routes.rb index ac139c0..9f11b47 100644 --- a/spec/support/test_app/config/routes.rb +++ b/spec/support/test_app/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do root to: 'application#home' end diff --git a/spec/support/test_app/db/seeds.rb b/spec/support/test_app/db/seeds.rb index 4edb1e8..1e7cc80 100644 --- a/spec/support/test_app/db/seeds.rb +++ b/spec/support/test_app/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 rake db:seed (or created alongside the db with db:setup). # diff --git a/spec/support/test_app/edge/another_edge.rb b/spec/support/test_app/edge/another_edge.rb index 5b69897..a256168 100644 --- a/spec/support/test_app/edge/another_edge.rb +++ b/spec/support/test_app/edge/another_edge.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + include RailsEdgeTest::Dsl controller ApplicationController do diff --git a/spec/support/test_app/edge/example_edge.rb b/spec/support/test_app/edge/example_edge.rb index db3fc50..4c6b0b3 100644 --- a/spec/support/test_app/edge/example_edge.rb +++ b/spec/support/test_app/edge/example_edge.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + include RailsEdgeTest::Dsl controller ApplicationController do