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

@@ -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'

View File

@@ -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!

View File

@@ -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

View File

@@ -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

View File

@@ -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