Miscellaneous updates to appease Rubocop

This commit is contained in:
Brandon Robins
2018-01-04 00:29:51 -06:00
parent 45ec304b26
commit 96116543d3
5 changed files with 28 additions and 16 deletions

View File

@@ -1,9 +1,11 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install' # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper' require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test' ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../dummy/config/environment', __FILE__) require File.expand_path('../dummy/config/environment', __FILE__)
# Prevent database truncation if the environment is production # 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' require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point! # Add additional requires below this line. Rails is not loaded until this point!

View File

@@ -1,13 +1,15 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
RSpec.describe 'calligraphy_resource', :type => :routing do RSpec.describe 'calligraphy_resource', type: :routing do
describe 'routes to WebDavRequests controller' do describe 'routes to WebDavRequests controller' do
context 'for OPTIONS requests' do context 'for OPTIONS requests' do
it do it do
expect(options: '/test/one').to route_to( expect(options: '/test/one').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'one', resource: 'one'
) )
end end
end end
@@ -17,7 +19,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(options: '/test/two').to route_to( expect(options: '/test/two').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'two', resource: 'two'
) )
end end
end end
@@ -27,7 +29,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(put: '/test/three').to route_to( expect(put: '/test/three').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'three', resource: 'three'
) )
end end
end end
@@ -37,7 +39,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(delete: '/test/four').to route_to( expect(delete: '/test/four').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'four', resource: 'four'
) )
end end
end end
@@ -47,7 +49,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(copy: '/test/five').to route_to( expect(copy: '/test/five').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'five', resource: 'five'
) )
end end
end end
@@ -57,7 +59,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(move: '/test/six').to route_to( expect(move: '/test/six').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'six', resource: 'six'
) )
end end
end end
@@ -67,7 +69,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(mkcol: '/test/seven').to route_to( expect(mkcol: '/test/seven').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'seven', resource: 'seven'
) )
end end
end end
@@ -77,7 +79,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(propfind: '/test/eight').to route_to( expect(propfind: '/test/eight').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'eight', resource: 'eight'
) )
end end
end end
@@ -87,7 +89,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(proppatch: '/test/nine').to route_to( expect(proppatch: '/test/nine').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'nine', resource: 'nine'
) )
end end
end end
@@ -97,7 +99,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(lock: '/test/ten').to route_to( expect(lock: '/test/ten').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'ten', resource: 'ten'
) )
end end
end end
@@ -107,7 +109,7 @@ RSpec.describe 'calligraphy_resource', :type => :routing do
expect(unlock: '/test/eleven').to route_to( expect(unlock: '/test/eleven').to route_to(
controller: 'calligraphy/rails/web_dav_requests', controller: 'calligraphy/rails/web_dav_requests',
action: 'invoke_method', action: 'invoke_method',
resource: 'eleven', resource: 'eleven'
) )
end end
end end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # 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`. # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause # 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, # Use the documentation formatter for detailed output,
# unless a formatter has already been configured # unless a formatter has already been configured
# (e.g. via a command-line flag). # (e.g. via a command-line flag).
config.default_formatter = "doc" config.default_formatter = 'doc'
end end
# Print the 10 slowest examples and example groups at the # Print the 10 slowest examples and example groups at the

View File

@@ -1,7 +1,13 @@
# frozen_string_literal: true
module ActionDispatch module ActionDispatch
module Integration module Integration
module RequestHelpers 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| define_method method do |path, **args|
process method.to_sym, path, **args process method.to_sym, path, **args
end end