From 96116543d3095291d913a5e7380b34ceef5c0c3f Mon Sep 17 00:00:00 2001 From: Brandon Robins Date: Thu, 4 Jan 2018 00:29:51 -0600 Subject: [PATCH] Miscellaneous updates to appease Rubocop --- calligraphy.gemspec | 2 +- spec/rails_helper.rb | 4 ++- .../calligraphy_resource_routes_spec.rb | 26 ++++++++++--------- spec/spec_helper.rb | 4 ++- spec/support/request_helpers.rb | 8 +++++- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/calligraphy.gemspec b/calligraphy.gemspec index 0b59b18..5d7aa0f 100644 --- a/calligraphy.gemspec +++ b/calligraphy.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.3.0' - s.files = Dir['lib/**/*', 'LICENSE', 'README.md'] + s.files = Dir['lib/**/*', 'LICENSE', 'README.md'] s.add_dependency 'rails', '~> 5.0', '>= 5.0' diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 483b6c6..d00b547 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../dummy/config/environment', __FILE__) # Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? +abort('The Rails environment is running in production mode!') if Rails.env.production? require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! diff --git a/spec/routing/calligraphy_resource_routes_spec.rb b/spec/routing/calligraphy_resource_routes_spec.rb index 999531b..dcdaa5e 100644 --- a/spec/routing/calligraphy_resource_routes_spec.rb +++ b/spec/routing/calligraphy_resource_routes_spec.rb @@ -1,13 +1,15 @@ +# frozen_string_literal: true + require 'rails_helper' -RSpec.describe 'calligraphy_resource', :type => :routing do +RSpec.describe 'calligraphy_resource', type: :routing do describe 'routes to WebDavRequests controller' do context 'for OPTIONS requests' do it do expect(options: '/test/one').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'one', + resource: 'one' ) end end @@ -17,7 +19,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(options: '/test/two').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'two', + resource: 'two' ) end end @@ -27,7 +29,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(put: '/test/three').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'three', + resource: 'three' ) end end @@ -37,7 +39,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(delete: '/test/four').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'four', + resource: 'four' ) end end @@ -47,7 +49,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(copy: '/test/five').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'five', + resource: 'five' ) end end @@ -57,7 +59,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(move: '/test/six').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'six', + resource: 'six' ) end end @@ -67,7 +69,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(mkcol: '/test/seven').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'seven', + resource: 'seven' ) end end @@ -77,7 +79,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(propfind: '/test/eight').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'eight', + resource: 'eight' ) end end @@ -87,7 +89,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(proppatch: '/test/nine').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'nine', + resource: 'nine' ) end end @@ -97,7 +99,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(lock: '/test/ten').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'ten', + resource: 'ten' ) end end @@ -107,7 +109,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do expect(unlock: '/test/eleven').to route_to( controller: 'calligraphy/rails/web_dav_requests', action: 'invoke_method', - resource: 'eleven', + resource: 'eleven' ) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4fd2c52..3b3e56c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause @@ -70,7 +72,7 @@ RSpec.configure do |config| # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). - config.default_formatter = "doc" + config.default_formatter = 'doc' end # Print the 10 slowest examples and example groups at the diff --git a/spec/support/request_helpers.rb b/spec/support/request_helpers.rb index 61793f5..dad6d7a 100644 --- a/spec/support/request_helpers.rb +++ b/spec/support/request_helpers.rb @@ -1,7 +1,13 @@ +# frozen_string_literal: true + module ActionDispatch module Integration module RequestHelpers - %w[copy move mkcol options propfind proppatch lock unlock].each do |method| + request_methods = %w[ + copy move mkcol options propfind proppatch lock unlock + ] + + request_methods.each do |method| define_method method do |path, **args| process method.to_sym, path, **args end