From 55e93bf85bcb7c8eaeca7d7cd5540779155ea7b6 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Thu, 28 Jan 2016 15:23:35 -0500 Subject: [PATCH 1/2] Ensure that DIRECTORY_MAPPINGS is available Previous, we just check that `RSpec::Rails` was defined, which it can be yet *not* have `RSpec::Rails::DIRECTORY_MAPPINGS` defined. Lets ensure it is defined. --- lib/rspec_api_documentation/dsl.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/dsl.rb b/lib/rspec_api_documentation/dsl.rb index 646337ab..2d79058c 100644 --- a/lib/rspec_api_documentation/dsl.rb +++ b/lib/rspec_api_documentation/dsl.rb @@ -2,6 +2,7 @@ require "rspec_api_documentation/dsl/resource" require "rspec_api_documentation/dsl/endpoint" require "rspec_api_documentation/dsl/callback" +require "rspec/support/warnings" module RspecApiDocumentation @@ -36,7 +37,7 @@ def resource(*args, &block) RSpec.configuration.include RspecApiDocumentation::DSL::Callback, :api_doc_dsl => :callback RSpec.configuration.backtrace_exclusion_patterns << %r{lib/rspec_api_documentation/dsl/} -if defined? RSpec::Rails +if defined? RSpec::Rails::DIRECTORY_MAPPINGS RSpec::Rails::DIRECTORY_MAPPINGS[:acceptance] = %w[spec acceptance] RSpec.configuration.infer_spec_type_from_file_location! end From 8f4b39df352f8e06f88ea3a31fbc422d7f4760d2 Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Thu, 28 Jan 2016 15:29:45 -0500 Subject: [PATCH 2/2] Remove unnecessary require --- lib/rspec_api_documentation/dsl.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rspec_api_documentation/dsl.rb b/lib/rspec_api_documentation/dsl.rb index 2d79058c..b0a7f91a 100644 --- a/lib/rspec_api_documentation/dsl.rb +++ b/lib/rspec_api_documentation/dsl.rb @@ -2,7 +2,6 @@ require "rspec_api_documentation/dsl/resource" require "rspec_api_documentation/dsl/endpoint" require "rspec_api_documentation/dsl/callback" -require "rspec/support/warnings" module RspecApiDocumentation