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

"TypeError: no implicit conversion of nil into Hash" when an example URI doesn't match request uri - templating issue #183

Open
jennifersmith opened this issue Mar 22, 2016 · 0 comments

Comments

@jennifersmith
Copy link

Hi there,

When the URI of an example doesn't match the contract request URI, we get a slightly unhelpful error message "TypeError: no implicit conversion of nil into Hash" . For example, parts of the contract look a little like this:

  "request": {
   "host": "example.com"
    "path": "/menu"
  },
...
  "examples": {
    "default": {
      "request": {
        "uri": "http://NOTEXAMPLE.COM/menu"
      }

Seems as if Pacto::Actors::FromExamples is complaining as this causes example_uri_values to return nil.

Pull request that changes the error to be a bit more meaningful to follow ... though could understand if you preferred recovery of this scenario as an alternative!

( Aside: I am not sure I fully understand how one might go about changing the examples to have non-absolute URIs which in our case would fix the issue... perhaps I am missing something :) )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant