collectiveidea / json_spec

Easily handle JSON in RSpec and Cucumber
rubygems.org/gems/json_spec
MIT License
919 stars 114 forks source link

Update cucumber.rb #105

Open SkylerBleu opened 5 years ago

SkylerBleu commented 5 years ago

Hello, I'm requesting this extra regex option get added to cucumber.rb to fix an issue I'm having with Scenario Outlines.

Here is an example:

Scenario Outline: Example of scenario outline issue
      Given User makes GET request to "www.give-me-a-json.com/api/json"
      And   User receives 200 response code
      Then  the JSON response at "data/someInteger" should be <integer>

      Examples:
      | integer |
      | 5       |

^^^ The above will give me an undefined step reference error while conversely....

Scenario: Example of scenario outline issue
      Given User makes GET request to "www.give-me-a-json.com/api/json"
      And   User receives 200 response code
      Then  the JSON response at "data/someInteger" should be 5

This will work fine. Adding <.*> will allow for examples table entries to be read, regardless of quotations. It's also an improvement because if the value passed in by the examples table doesn't follow the regex, then it will throw a runtime error.