Fix a bunch of rubocop offenses

This commit is contained in:
Lars Henrik Mai 2020-03-09 14:55:53 +01:00
parent 106c6800a4
commit 4e1e8b798a
17 changed files with 57 additions and 222 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
@ -24,8 +26,8 @@
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'
guard :rspec, cmd: "bin/rspec" do
require "guard/rspec/dsl"
guard :rspec, cmd: 'bin/rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)
# Feel free to open issues for suggestions and improvements
@ -41,15 +43,15 @@ guard :rspec, cmd: "bin/rspec" do
dsl.watch_spec_files_for(ruby.lib_files)
# Rails files
rails = dsl.rails(view_extensions: %w(erb haml slim))
rails = dsl.rails(view_extensions: %w[erb haml slim])
dsl.watch_spec_files_for(rails.app_files)
dsl.watch_spec_files_for(rails.views)
watch(rails.controllers) do |m|
[
rspec.spec.("routing/#{m[1]}_routing"),
rspec.spec.("controllers/#{m[1]}_controller"),
rspec.spec.("acceptance/#{m[1]}")
rspec.spec.call("routing/#{m[1]}_routing"),
rspec.spec.call("controllers/#{m[1]}_controller"),
rspec.spec.call("acceptance/#{m[1]}")
]
end
@ -59,12 +61,12 @@ guard :rspec, cmd: "bin/rspec" do
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
# Capybara features specs
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
end
end