Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
Fix nil issue of ��example_uri_values(contract)
Browse files Browse the repository at this point in the history
I got following error when simulate the contract with url like: http://abc.com?a=3&d=4

     Failure/Error: result = contracts.simulate_consumers
     TypeError:
       no implicit conversion of nil into Hash
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/actors/from_examples.rb:35:in `merge!'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/actors/from_examples.rb:35:in `build_request'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/consumer.rb:70:in `build_request'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/consumer.rb:52:in `reenact'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/contract.rb:64:in `execute'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/contract.rb:40:in `simulate_request'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/contract_set.rb:9:in `map'
     # /home/david/.rvm/gems/ruby-2.1.1/gems/pacto-0.4.0.rc1/lib/pacto/contract_set.rb:9:in `simulate_consumers'
  • Loading branch information
ruanwz committed Nov 20, 2014
1 parent 399ab81 commit c1f3e7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pacto/actors/from_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def example_uri_values(contract)
uri_template = contract.request.pattern.uri_template
if contract.examples && contract.examples.values.first[:request][:uri]
example_uri = contract.examples.values.first[:request][:uri]
uri_template.extract example_uri
uri_template.extract(example_uri) || {}
else
{}
end
Expand Down

0 comments on commit c1f3e7b

Please sign in to comment.