Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
This repository was 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

Description

@jennifersmith

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 :) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions