From 4da465950367a288b666ce9a5df0a09335eac8fa Mon Sep 17 00:00:00 2001 From: Jonathan Abbett Date: Mon, 21 Nov 2016 16:09:18 -0500 Subject: [PATCH] rubocop --- Gemfile | 1 + Gemfile.lock | 14 ++++++++ Rakefile | 7 ++-- abraham.gemspec | 28 ++++++++-------- .../abraham_histories_controller.rb | 1 + app/helpers/abraham_helper.rb | 12 ++++--- app/models/abraham_history.rb | 1 + app/models/application_record.rb | 1 + bin/rails | 1 + config/routes.rb | 1 + lib/abraham.rb | 1 + lib/abraham/engine.rb | 1 + lib/abraham/version.rb | 1 + lib/generators/abraham/install_generator.rb | 7 ++-- .../abraham/templates/initializer.rb | 1 + lib/generators/abraham/templates/migration.rb | 1 + lib/tasks/abraham_tasks.rake | 1 + test/abraham_test.rb | 3 +- test/dummy/Rakefile | 1 + .../app/channels/application_cable/channel.rb | 1 + .../channels/application_cable/connection.rb | 1 + .../app/controllers/application_controller.rb | 1 + .../app/controllers/dashboard_controller.rb | 1 + test/dummy/app/helpers/application_helper.rb | 1 + test/dummy/app/helpers/dashboard_helper.rb | 1 + test/dummy/app/jobs/application_job.rb | 1 + test/dummy/app/mailers/application_mailer.rb | 1 + test/dummy/app/models/application_record.rb | 1 + test/dummy/bin/bundle | 1 + test/dummy/bin/rails | 1 + test/dummy/bin/rake | 1 + test/dummy/bin/setup | 1 + test/dummy/bin/update | 1 + test/dummy/config.ru | 1 + test/dummy/config/application.rb | 4 +-- test/dummy/config/boot.rb | 1 + test/dummy/config/environment.rb | 1 + test/dummy/config/environments/development.rb | 1 + test/dummy/config/environments/production.rb | 5 +-- test/dummy/config/environments/test.rb | 1 + test/dummy/config/initializers/abraham.rb | 1 + .../application_controller_renderer.rb | 1 + test/dummy/config/initializers/assets.rb | 1 + .../initializers/backtrace_silencers.rb | 1 + .../config/initializers/cookies_serializer.rb | 1 + .../initializers/filter_parameter_logging.rb | 1 + test/dummy/config/initializers/inflections.rb | 1 + test/dummy/config/initializers/mime_types.rb | 1 + .../initializers/new_framework_defaults.rb | 1 + .../config/initializers/session_store.rb | 1 + .../config/initializers/wrap_parameters.rb | 1 + test/dummy/config/puma.rb | 7 ++-- test/dummy/config/routes.rb | 1 + test/dummy/config/spring.rb | 1 + ...20161118143752_create_abraham_histories.rb | 1 + test/dummy/db/schema.rb | 25 +++++++------- .../abraham_histories_controller_test.rb | 5 +-- .../controllers/dashboard_controller_test.rb | 29 ++++++++-------- test/install_generator_test.rb | 33 +++++++++---------- test/integration/navigation_test.rb | 2 +- test/models/abraham_history_test.rb | 1 + test/test_helper.rb | 9 ++--- 62 files changed, 152 insertions(+), 85 deletions(-) diff --git a/Gemfile b/Gemfile index 7be50e3..aa05482 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'http://rubygems.org' source 'http://rails-assets.org' diff --git a/Gemfile.lock b/Gemfile.lock index 81e1349..a136515 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,6 +49,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) + ast (2.3.0) builder (3.2.2) concurrent-ruby (1.0.2) erubis (2.7.0) @@ -72,6 +73,9 @@ GEM nio4r (1.2.1) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) + parser (2.3.2.0) + ast (~> 2.2) + powerpack (0.1.1) rack (2.0.1) rack-test (0.6.3) rack (>= 1.0) @@ -101,7 +105,15 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (2.1.0) rake (11.3.0) + rubocop (0.45.0) + parser (>= 2.3.1.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) sass (3.4.22) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -122,6 +134,7 @@ GEM tilt (2.0.5) tzinfo (1.2.2) thread_safe (~> 0.1) + unicode-display_width (1.1.1) websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -131,6 +144,7 @@ PLATFORMS DEPENDENCIES abraham! + rubocop sqlite3 BUNDLED WITH diff --git a/Rakefile b/Rakefile index c6ceb5e..0ca2ff1 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'bundler/setup' rescue LoadError @@ -14,14 +15,11 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end -APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__) +APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__) load 'rails/tasks/engine.rake' - load 'rails/tasks/statistics.rake' - - require 'bundler/gem_tasks' require 'rake/testtask' @@ -33,5 +31,4 @@ Rake::TestTask.new(:test) do |t| t.verbose = false end - task default: :test diff --git a/abraham.gemspec b/abraham.gemspec index 54fc96c..68745aa 100644 --- a/abraham.gemspec +++ b/abraham.gemspec @@ -1,26 +1,28 @@ -$:.push File.expand_path("../lib", __FILE__) +# frozen_string_literal: true +$LOAD_PATH.push File.expand_path('../lib', __FILE__) # Maintain your gem's version: -require "abraham/version" +require 'abraham/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| - s.name = "abraham" + s.name = 'abraham' s.version = Abraham::VERSION - s.authors = ["Jonathan Abbett"] - s.email = ["jonathan@act.md"] - s.homepage = "http://getabraham.com" - s.summary = "Trackable application tours for Rails with i18n support." - s.description = "Guide your users in the one true path." - s.license = "MIT" + s.authors = ['Jonathan Abbett'] + s.email = ['jonathan@act.md'] + s.homepage = 'http://getabraham.com' + s.summary = 'Trackable application tours for Rails with i18n support.' + s.description = 'Guide your users in the one true path.' + s.license = 'MIT' - s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] + s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md'] - s.add_dependency "rails", "~> 5.0.0", ">= 5.0.0.1" + s.add_dependency 'rails', '~> 5.0.0', '>= 5.0.0.1' s.add_dependency 'sass-rails', '~> 5.0' - s.add_dependency "rails-assets-shepherd.js", "~> 1.8" + s.add_dependency 'rails-assets-shepherd.js', '~> 1.8' - s.add_development_dependency "sqlite3" + s.add_development_dependency 'sqlite3' + s.add_development_dependency 'rubocop' s.add_runtime_dependency 'jquery-rails' end diff --git a/app/controllers/abraham_histories_controller.rb b/app/controllers/abraham_histories_controller.rb index c90162d..387cfde 100644 --- a/app/controllers/abraham_histories_controller.rb +++ b/app/controllers/abraham_histories_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AbrahamHistoriesController < ApplicationController def create @abraham_history = AbrahamHistory.new(abraham_history_params) diff --git a/app/helpers/abraham_helper.rb b/app/helpers/abraham_helper.rb index 7319a5b..1dad51d 100644 --- a/app/helpers/abraham_helper.rb +++ b/app/helpers/abraham_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module AbrahamHelper def abraham_tour # Do we have tours for this controller/action in the user's locale? @@ -10,15 +11,16 @@ module AbrahamHelper if tours completed = AbrahamHistory.where( - creator_id: current_user, controller_name: controller_name, - action_name: action_name) + creator_id: current_user, controller_name: controller_name, + action_name: action_name + ) remaining = tours.keys - completed.map(&:tour_name) if remaining.any? # Generate the javascript snippet for the next remaining tour - render(:partial => 'application/abraham', - :locals => {:tour_name => remaining.first, - :steps => tours[remaining.first]['steps']}) + render(partial: 'application/abraham', + locals: { tour_name: remaining.first, + steps: tours[remaining.first]['steps'] }) end end end diff --git a/app/models/abraham_history.rb b/app/models/abraham_history.rb index 87fe686..9f621fd 100644 --- a/app/models/abraham_history.rb +++ b/app/models/abraham_history.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class AbrahamHistory < ApplicationRecord end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba..767a072 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/bin/rails b/bin/rails index 6d3f98b..4824017 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # This command will automatically be run when you run "rails" with Rails gems # installed from the root of your application. diff --git a/config/routes.rb b/config/routes.rb index 2fc859c..773d296 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.routes.draw do resources :abraham_histories, only: :create end diff --git a/lib/abraham.rb b/lib/abraham.rb index 4e6d200..d4213bf 100644 --- a/lib/abraham.rb +++ b/lib/abraham.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'abraham/engine' module Abraham diff --git a/lib/abraham/engine.rb b/lib/abraham/engine.rb index 0409209..b1aed73 100644 --- a/lib/abraham/engine.rb +++ b/lib/abraham/engine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' require 'rails-assets-shepherd.js' require 'jquery-rails' diff --git a/lib/abraham/version.rb b/lib/abraham/version.rb index b25cc8d..5fbfd1e 100644 --- a/lib/abraham/version.rb +++ b/lib/abraham/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Abraham VERSION = '0.1.0' end diff --git a/lib/generators/abraham/install_generator.rb b/lib/generators/abraham/install_generator.rb index cec82a1..ffbe7f7 100644 --- a/lib/generators/abraham/install_generator.rb +++ b/lib/generators/abraham/install_generator.rb @@ -1,13 +1,14 @@ +# frozen_string_literal: true require 'rails/generators' -require "rails/generators/active_record" +require 'rails/generators/active_record' module Abraham module Generators class InstallGenerator < ActiveRecord::Generators::Base argument :name, type: :string, default: 'random_name' - class_option :'skip-migration', :type => :boolean, :desc => "Don't generate a migration for the histories table" - class_option :'skip-initializer', :type => :boolean, :desc => "Don't generate an initializer" + class_option :'skip-migration', type: :boolean, desc: "Don't generate a migration for the histories table" + class_option :'skip-initializer', type: :boolean, desc: "Don't generate an initializer" source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) diff --git a/lib/generators/abraham/templates/initializer.rb b/lib/generators/abraham/templates/initializer.rb index 29d4454..98145b1 100644 --- a/lib/generators/abraham/templates/initializer.rb +++ b/lib/generators/abraham/templates/initializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do tours = {} diff --git a/lib/generators/abraham/templates/migration.rb b/lib/generators/abraham/templates/migration.rb index ab42707..295ebdd 100644 --- a/lib/generators/abraham/templates/migration.rb +++ b/lib/generators/abraham/templates/migration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateAbrahamHistories < ActiveRecord::Migration[5.0] def change create_table :abraham_histories do |t| diff --git a/lib/tasks/abraham_tasks.rake b/lib/tasks/abraham_tasks.rake index 4dcd380..c87398e 100644 --- a/lib/tasks/abraham_tasks.rake +++ b/lib/tasks/abraham_tasks.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true # desc "Explaining what the task does" # task :abraham do # # Task goes here diff --git a/test/abraham_test.rb b/test/abraham_test.rb index 0555ca1..845f33e 100644 --- a/test/abraham_test.rb +++ b/test/abraham_test.rb @@ -1,7 +1,8 @@ +# frozen_string_literal: true require 'test_helper' class Abraham::Test < ActiveSupport::TestCase - test "truth" do + test 'truth' do assert_kind_of Module, Abraham end end diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile index e85f913..84f2bc3 100644 --- a/test/dummy/Rakefile +++ b/test/dummy/Rakefile @@ -1,3 +1,4 @@ +# 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/test/dummy/app/channels/application_cable/channel.rb b/test/dummy/app/channels/application_cable/channel.rb index d672697..51e3e93 100644 --- a/test/dummy/app/channels/application_cable/channel.rb +++ b/test/dummy/app/channels/application_cable/channel.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/test/dummy/app/channels/application_cable/connection.rb b/test/dummy/app/channels/application_cable/connection.rb index 0ff5442..fa70319 100644 --- a/test/dummy/app/channels/application_cable/connection.rb +++ b/test/dummy/app/channels/application_cable/connection.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb index 642fd11..55b5afb 100644 --- a/test/dummy/app/controllers/application_controller.rb +++ b/test/dummy/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationController < ActionController::Base protect_from_forgery with: :exception helper_method :current_user diff --git a/test/dummy/app/controllers/dashboard_controller.rb b/test/dummy/app/controllers/dashboard_controller.rb index 1716cde..9c70ebc 100644 --- a/test/dummy/app/controllers/dashboard_controller.rb +++ b/test/dummy/app/controllers/dashboard_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class DashboardController < ApplicationController def home end diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb index de6be79..71249b9 100644 --- a/test/dummy/app/helpers/application_helper.rb +++ b/test/dummy/app/helpers/application_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module ApplicationHelper end diff --git a/test/dummy/app/helpers/dashboard_helper.rb b/test/dummy/app/helpers/dashboard_helper.rb index a94ddfc..79ce46b 100644 --- a/test/dummy/app/helpers/dashboard_helper.rb +++ b/test/dummy/app/helpers/dashboard_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module DashboardHelper end diff --git a/test/dummy/app/jobs/application_job.rb b/test/dummy/app/jobs/application_job.rb index a009ace..32fe70b 100644 --- a/test/dummy/app/jobs/application_job.rb +++ b/test/dummy/app/jobs/application_job.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true class ApplicationJob < ActiveJob::Base end diff --git a/test/dummy/app/mailers/application_mailer.rb b/test/dummy/app/mailers/application_mailer.rb index 286b223..2428900 100644 --- a/test/dummy/app/mailers/application_mailer.rb +++ b/test/dummy/app/mailers/application_mailer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/test/dummy/app/models/application_record.rb b/test/dummy/app/models/application_record.rb index 10a4cba..767a072 100644 --- a/test/dummy/app/models/application_record.rb +++ b/test/dummy/app/models/application_record.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle index 66e9889..86f3466 100755 --- a/test/dummy/bin/bundle +++ b/test/dummy/bin/bundle @@ -1,3 +1,4 @@ #!/usr/bin/env ruby +# frozen_string_literal: true ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails index 0739660..dd027b4 100755 --- a/test/dummy/bin/rails +++ b/test/dummy/bin/rails @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake index 1724048..609af74 100755 --- a/test/dummy/bin/rake +++ b/test/dummy/bin/rake @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/test/dummy/bin/setup b/test/dummy/bin/setup index e620b4d..ffca742 100755 --- a/test/dummy/bin/setup +++ b/test/dummy/bin/setup @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'pathname' require 'fileutils' include FileUtils diff --git a/test/dummy/bin/update b/test/dummy/bin/update index a8e4462..3f81e54 100755 --- a/test/dummy/bin/update +++ b/test/dummy/bin/update @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'pathname' require 'fileutils' include FileUtils diff --git a/test/dummy/config.ru b/test/dummy/config.ru index f7ba0b5..7eae264 100644 --- a/test/dummy/config.ru +++ b/test/dummy/config.ru @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This file is used by Rack-based servers to start the application. require_relative 'config/environment' diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index c772e70..6b3a2da 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) -require "abraham" +require 'abraham' module Dummy class Application < Rails::Application @@ -12,4 +13,3 @@ module Dummy # -- all .rb files in that directory are automatically loaded. end end - diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb index c9aef85..c90021f 100644 --- a/test/dummy/config/boot.rb +++ b/test/dummy/config/boot.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__) diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb index 426333b..12ea62f 100644 --- a/test/dummy/config/environment.rb +++ b/test/dummy/config/environment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Load the Rails application. require_relative 'application' diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index e64889c..8f4ad21 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index 739e81c..cbdb208 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -47,7 +48,7 @@ Rails.application.configure do config.log_level = :debug # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] + config.log_tags = [:request_id] # Use a different cache store in production. # config.cache_store = :mem_cache_store @@ -75,7 +76,7 @@ Rails.application.configure do # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') - if ENV["RAILS_LOG_TO_STDOUT"].present? + if ENV['RAILS_LOG_TO_STDOUT'].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index 30587ef..416a71c 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/test/dummy/config/initializers/abraham.rb b/test/dummy/config/initializers/abraham.rb index 1ea8829..b43fa98 100644 --- a/test/dummy/config/initializers/abraham.rb +++ b/test/dummy/config/initializers/abraham.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do tours = {} diff --git a/test/dummy/config/initializers/application_controller_renderer.rb b/test/dummy/config/initializers/application_controller_renderer.rb index 51639b6..315ac48 100644 --- a/test/dummy/config/initializers/application_controller_renderer.rb +++ b/test/dummy/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. # ApplicationController.renderer.defaults.merge!( diff --git a/test/dummy/config/initializers/assets.rb b/test/dummy/config/initializers/assets.rb index 01ef3e6..9287bcd 100644 --- a/test/dummy/config/initializers/assets.rb +++ b/test/dummy/config/initializers/assets.rb @@ -1,3 +1,4 @@ +# 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/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb index 59385cd..d0f0d3b 100644 --- a/test/dummy/config/initializers/backtrace_silencers.rb +++ b/test/dummy/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/test/dummy/config/initializers/cookies_serializer.rb b/test/dummy/config/initializers/cookies_serializer.rb index 5a6a32d..2a72959 100644 --- a/test/dummy/config/initializers/cookies_serializer.rb +++ b/test/dummy/config/initializers/cookies_serializer.rb @@ -1,3 +1,4 @@ +# 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/test/dummy/config/initializers/filter_parameter_logging.rb b/test/dummy/config/initializers/filter_parameter_logging.rb index 4a994e1..b7fe123 100644 --- a/test/dummy/config/initializers/filter_parameter_logging.rb +++ b/test/dummy/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,4 @@ +# 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/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb index ac033bf..aa7435f 100644 --- a/test/dummy/config/initializers/inflections.rb +++ b/test/dummy/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/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb index dc18996..6e1d16f 100644 --- a/test/dummy/config/initializers/mime_types.rb +++ b/test/dummy/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/test/dummy/config/initializers/new_framework_defaults.rb b/test/dummy/config/initializers/new_framework_defaults.rb index 0706caf..d3c12d7 100644 --- a/test/dummy/config/initializers/new_framework_defaults.rb +++ b/test/dummy/config/initializers/new_framework_defaults.rb @@ -1,3 +1,4 @@ +# 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.0 upgrade. diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb index e766b67..fcc1c91 100644 --- a/test/dummy/config/initializers/session_store.rb +++ b/test/dummy/config/initializers/session_store.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_dummy_session' diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb index bbfc396..18c3825 100644 --- a/test/dummy/config/initializers/wrap_parameters.rb +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -1,3 +1,4 @@ +# 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/test/dummy/config/puma.rb b/test/dummy/config/puma.rb index c7f311f..da41eff 100644 --- a/test/dummy/config/puma.rb +++ b/test/dummy/config/puma.rb @@ -1,19 +1,20 @@ +# 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 # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum, this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch('PORT') { 3000 } # Specifies the `environment` that Puma will run in. # -environment ENV.fetch("RAILS_ENV") { "development" } +environment ENV.fetch('RAILS_ENV') { 'development' } # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb index 781942a..40e2c71 100644 --- a/test/dummy/config/routes.rb +++ b/test/dummy/config/routes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.routes.draw do get 'dashboard/home' diff --git a/test/dummy/config/spring.rb b/test/dummy/config/spring.rb index c9119b4..312295f 100644 --- a/test/dummy/config/spring.rb +++ b/test/dummy/config/spring.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true %w( .ruby-version .rbenv-vars diff --git a/test/dummy/db/migrate/20161118143752_create_abraham_histories.rb b/test/dummy/db/migrate/20161118143752_create_abraham_histories.rb index ab42707..295ebdd 100644 --- a/test/dummy/db/migrate/20161118143752_create_abraham_histories.rb +++ b/test/dummy/db/migrate/20161118143752_create_abraham_histories.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateAbrahamHistories < ActiveRecord::Migration[5.0] def change create_table :abraham_histories do |t| diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 61e9a12..17fe716 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -10,18 +11,16 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161118143752) do - - create_table "abraham_histories", force: :cascade do |t| - t.string "controller_name" - t.string "action_name" - t.string "tour_name" - t.integer "creator_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["created_at"], name: "index_abraham_histories_on_created_at" - t.index ["creator_id"], name: "index_abraham_histories_on_creator_id" - t.index ["updated_at"], name: "index_abraham_histories_on_updated_at" +ActiveRecord::Schema.define(version: 20_161_118_143_752) do + create_table 'abraham_histories', force: :cascade do |t| + t.string 'controller_name' + t.string 'action_name' + t.string 'tour_name' + t.integer 'creator_id', null: false + t.datetime 'created_at', null: false + t.datetime 'updated_at', null: false + t.index ['created_at'], name: 'index_abraham_histories_on_created_at' + t.index ['creator_id'], name: 'index_abraham_histories_on_creator_id' + t.index ['updated_at'], name: 'index_abraham_histories_on_updated_at' end - end diff --git a/test/dummy/test/controllers/abraham_histories_controller_test.rb b/test/dummy/test/controllers/abraham_histories_controller_test.rb index aaf9c81..26ace95 100644 --- a/test/dummy/test/controllers/abraham_histories_controller_test.rb +++ b/test/dummy/test/controllers/abraham_histories_controller_test.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true require 'test_helper' class AbrahamHistoriesControllerTest < ActionDispatch::IntegrationTest - test "should create AbrahamHistory" do + test 'should create AbrahamHistory' do assert_difference ['AbrahamHistory.count'] do - post abraham_histories_url, as: :json, params: { abraham_history: { action_name: "foo", controller_name: "bar", tour_name: "baz"} } + post abraham_histories_url, as: :json, params: { abraham_history: { action_name: 'foo', controller_name: 'bar', tour_name: 'baz' } } end end end diff --git a/test/dummy/test/controllers/dashboard_controller_test.rb b/test/dummy/test/controllers/dashboard_controller_test.rb index 7652ba9..183c6e5 100644 --- a/test/dummy/test/controllers/dashboard_controller_test.rb +++ b/test/dummy/test/controllers/dashboard_controller_test.rb @@ -1,35 +1,36 @@ +# frozen_string_literal: true require 'test_helper' class DashboardControllerTest < ActionDispatch::IntegrationTest - test "uses configured shepherd theme" do + test 'uses configured shepherd theme' do # default get dashboard_home_url assert_response :success - assert_select "body script" do |element| + assert_select 'body script' do |element| # it's the home tour assert element.text.include? "classes: 'shepherd-theme-default'" end # custom - Rails.configuration.abraham.default_theme = "my-custom-theme" + Rails.configuration.abraham.default_theme = 'my-custom-theme' get dashboard_home_url - assert_select "body script" do |element| + assert_select 'body script' do |element| # it's the home tour assert element.text.include? "classes: 'my-custom-theme'" end end - test "home should have home tour code" do + test 'home should have home tour code' do get dashboard_home_url assert_response :success - assert_select "body script" do |element| + assert_select 'body script' do |element| # it's the home tour - assert element.text.include? "ENGLISH This first HOME step is centered text-only" + assert element.text.include? 'ENGLISH This first HOME step is centered text-only' # it has three steps - assert element.text.include? "step-1" - assert element.text.include? "step-2" - assert element.text.include? "step-3" + assert element.text.include? 'step-1' + assert element.text.include? 'step-2' + assert element.text.include? 'step-3' # it will post the right completion information assert element.text.include? "controller_name: 'dashboard'" assert element.text.include? "action_name: 'home'" @@ -37,15 +38,15 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest end end - test "other should have other tour code" do + test 'other should have other tour code' do get dashboard_other_url assert_response :success - assert_select "body script" do |element| + assert_select 'body script' do |element| # it's the home tour - assert element.text.include? "TOUR ONE step one ENGLISH" + assert element.text.include? 'TOUR ONE step one ENGLISH' # it has only one steps - assert element.text.include? "step-1" + assert element.text.include? 'step-1' # it will post the right completion information assert element.text.include? "controller_name: 'dashboard'" assert element.text.include? "action_name: 'other'" diff --git a/test/install_generator_test.rb b/test/install_generator_test.rb index 36d087a..8efbd10 100644 --- a/test/install_generator_test.rb +++ b/test/install_generator_test.rb @@ -1,48 +1,47 @@ +# frozen_string_literal: true require 'test_helper' -require "rails/generators" -require "generators/abraham/install_generator" +require 'rails/generators' +require 'generators/abraham/install_generator' class InstallGeneratorTest < Rails::Generators::TestCase - tests Abraham::Generators::InstallGenerator - destination File.expand_path("../../tmp", __FILE__) + destination File.expand_path('../../tmp', __FILE__) setup :prepare_destination - test "should generate a migration" do + test 'should generate a migration' do begin run_generator - assert_migration "db/migrate/create_abraham_histories" + assert_migration 'db/migrate/create_abraham_histories' ensure - FileUtils.rm_rf self.destination_root + FileUtils.rm_rf destination_root end end - test "should skip the migration when told to do so" do + test 'should skip the migration when told to do so' do begin run_generator ['--skip-migration'] - assert_no_migration "db/migrate/create_abraham_histories" + assert_no_migration 'db/migrate/create_abraham_histories' ensure - FileUtils.rm_rf self.destination_root + FileUtils.rm_rf destination_root end end - test "should generate an initializer" do + test 'should generate an initializer' do begin run_generator - assert_file "config/initializers/abraham.rb" + assert_file 'config/initializers/abraham.rb' ensure - FileUtils.rm_rf self.destination_root + FileUtils.rm_rf destination_root end end - test "should skip the initializer when told to do so" do + test 'should skip the initializer when told to do so' do begin run_generator ['--skip-initializer'] - assert_no_file "config/initializers/abraham.rb" + assert_no_file 'config/initializers/abraham.rb' ensure - FileUtils.rm_rf self.destination_root + FileUtils.rm_rf destination_root end end - end diff --git a/test/integration/navigation_test.rb b/test/integration/navigation_test.rb index f5d1ec2..3c97384 100644 --- a/test/integration/navigation_test.rb +++ b/test/integration/navigation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class NavigationTest < ActionDispatch::IntegrationTest @@ -5,4 +6,3 @@ class NavigationTest < ActionDispatch::IntegrationTest # assert true # end end - diff --git a/test/models/abraham_history_test.rb b/test/models/abraham_history_test.rb index 0fcbeaf..de50c1b 100644 --- a/test/models/abraham_history_test.rb +++ b/test/models/abraham_history_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class AbrahamHistoryTest < ActiveSupport::TestCase diff --git a/test/test_helper.rb b/test/test_helper.rb index e1a2261..af68d44 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true # Configure Rails Environment -ENV["RAILS_ENV"] = "test" +ENV['RAILS_ENV'] = 'test' -require File.expand_path("../../test/dummy/config/environment.rb", __FILE__) -ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)] -require "rails/test_help" +require File.expand_path('../../test/dummy/config/environment.rb', __FILE__) +ActiveRecord::Migrator.migrations_paths = [File.expand_path('../../test/dummy/db/migrate', __FILE__)] +require 'rails/test_help' # Filter out Minitest backtrace while allowing backtrace from other libraries # to be shown.