From 83d64b7e38bab26032aca4932dc36855f9caa876 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 4 Oct 2019 01:42:28 +0800 Subject: [PATCH] [Ruby] fix ruby test, update error message (#4041) * fix ruby test, update error message * use block * update template for api client spec * update test files --- .../src/main/resources/ruby-client/api_client_spec.mustache | 2 +- samples/client/petstore/ruby/spec/api_client_spec.rb | 2 +- .../client/petstore/ruby-faraday/spec/api_client_spec.rb | 2 +- samples/openapi3/client/petstore/ruby/spec/api_client_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client_spec.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client_spec.mustache index 3e8d070ef9f7..364c60419c4f 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client_spec.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client_spec.mustache @@ -150,7 +150,7 @@ describe {{moduleName}}::ApiClient do end it 'fails for invalid collection format' do - expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID') end end diff --git a/samples/client/petstore/ruby/spec/api_client_spec.rb b/samples/client/petstore/ruby/spec/api_client_spec.rb index aea4c5f46c9d..34fdb55221e7 100644 --- a/samples/client/petstore/ruby/spec/api_client_spec.rb +++ b/samples/client/petstore/ruby/spec/api_client_spec.rb @@ -156,7 +156,7 @@ describe Petstore::ApiClient do end it 'fails for invalid collection format' do - expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID') end end diff --git a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb index 4a65cbd55a4b..824f318c247b 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb +++ b/samples/openapi3/client/petstore/ruby-faraday/spec/api_client_spec.rb @@ -118,7 +118,7 @@ describe Petstore::ApiClient do end it 'fails for invalid collection format' do - expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID') end end diff --git a/samples/openapi3/client/petstore/ruby/spec/api_client_spec.rb b/samples/openapi3/client/petstore/ruby/spec/api_client_spec.rb index aea4c5f46c9d..34fdb55221e7 100644 --- a/samples/openapi3/client/petstore/ruby/spec/api_client_spec.rb +++ b/samples/openapi3/client/petstore/ruby/spec/api_client_spec.rb @@ -156,7 +156,7 @@ describe Petstore::ApiClient do end it 'fails for invalid collection format' do - expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID') end end