From a0d07455eaf3057ed8de5fec2bfd7c109a05f74c Mon Sep 17 00:00:00 2001 From: Marek L Date: Fri, 10 Jun 2022 14:56:56 +0100 Subject: [PATCH 1/4] Require explicitly ActiveSupport Array#extract_options! Why: Trying run the specs on vanilla machine produces error: ``` resource.rb:10:in `block in define_action: undefined method extract_options! for ["/path"]:Array (NoMethodError) ``` --- lib/rspec_api_documentation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb index 5986aadb..f37d74a5 100644 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -1,5 +1,6 @@ require 'active_support' require 'active_support/inflector' +require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/hash/conversions' require 'active_support/core_ext/hash/deep_merge' require 'cgi' From 40c1dfc3a9e10ce8b905ca3609b72c458ca9f11a Mon Sep 17 00:00:00 2001 From: Marek L Date: Fri, 10 Jun 2022 15:11:23 +0100 Subject: [PATCH 2/4] Bump dev dependency on Faraday gem to ~> 1.0.0 Why: Trying to run specs with the old version using `bundle exec rspec` leads to an error: ``` tried to create Proc object without a block faraday-0.9.2/lib/faraday/options.rb:153:in new: tried to create Proc object without a block (ArgumentError) ... ../http_test_client.rb:2:in require ``` --- rspec_api_documentation.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rspec_api_documentation.gemspec b/rspec_api_documentation.gemspec index 20e1258d..e4406c8e 100644 --- a/rspec_api_documentation.gemspec +++ b/rspec_api_documentation.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |s| s.add_development_dependency "rack-oauth2", "~> 1.2.2" s.add_development_dependency "webmock", "~> 3.8.3" s.add_development_dependency "rspec-its", "~> 1.2.0" - s.add_development_dependency "faraday", "~> 0.9.2" + s.add_development_dependency "faraday", "~> 1.0.0" s.add_development_dependency "nokogiri", "~> 1.8.4" s.add_development_dependency "yard", "~> 0.9.15" s.add_development_dependency "inch", "~> 0.8.0" From 758c879893a21233c0eb977e79ef026f263fc37e Mon Sep 17 00:00:00 2001 From: Marek L Date: Fri, 10 Jun 2022 15:24:26 +0100 Subject: [PATCH 3/4] Require explicitly ActiveSupport Hash::Keys Why: Fixes error when running specs `bundle exec (/home/m/.rbenv/versions/3.1.0/bin/rspec) bundle exec rspec spec/dsl_spec.rb` ``` NoMethodError: undefined method `stringify_keys for {:name=>"Friday Order"}:Hash ... dsl/endpoint.rb:171:in `block in extra_params ``` --- lib/rspec_api_documentation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rspec_api_documentation.rb b/lib/rspec_api_documentation.rb index f37d74a5..a15e6018 100644 --- a/lib/rspec_api_documentation.rb +++ b/lib/rspec_api_documentation.rb @@ -3,6 +3,7 @@ require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/hash/conversions' require 'active_support/core_ext/hash/deep_merge' +require 'active_support/core_ext/hash/keys' require 'cgi' require 'json' From 26af788cb15ab8f3576cc25d0eaf83127970a2d8 Mon Sep 17 00:00:00 2001 From: Marek L Date: Fri, 10 Jun 2022 15:29:49 +0100 Subject: [PATCH 4/4] Update Api Blueprint spec assertions to reflect implementation Why: Given specs fails on expecting `description` field being empty while in current version it contains capitalised version of `name` attribute. ``` expected: [{:required=>false, :name=>"description", :description=>nil, :properties_description=>"optional"}] got: [{:required=>false, :name=>"description", :description=>"Description", :properties_description=>"optional"}] ``` --- spec/views/api_blueprint_index_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/views/api_blueprint_index_spec.rb b/spec/views/api_blueprint_index_spec.rb index 1d526597..e923abf2 100644 --- a/spec/views/api_blueprint_index_spec.rb +++ b/spec/views/api_blueprint_index_spec.rb @@ -142,7 +142,7 @@ properties_description: "required, string" }, { name: "option", - description: nil, + description: 'Option', properties_description: 'optional' }] expect(post_route_with_optionals[:has_attributes?]).to eq false @@ -158,7 +158,7 @@ expect(posts_route[:attributes]).to eq [{ required: false, name: "description", - description: nil, + description: 'Description', properties_description: "optional" }] end