: matters?
When I run cucumber
, cucumber told me there is a Ambiguous match:
Feature: Login
In order to login
As an API client
I want to login as a valid user
Scenario: I login as an valid user # features/login.feature:7
Given User "user" exists with password "password" and id "1" # features/step_definitions/login.rb:1
When I send a POST request to "/api/v1/login" with the following # features/step_definitions/login.rb:5
"""
{
"name":"user",
"password":"password"
}
"""
Then the response status should be "200" # features/step_definitions/login.rb:9
And the JSON response should be: # features/login.feature:17
"""
{
"user_id": 1
}
"""
Ambiguous match of "the JSON response should be:":
json_spec-1.1.4/lib/json_spec/cucumber.rb:13:in `/^the (?:JSON|json)(?: response)?(?: at "(.*)")? should( not)? be:$/'
features/step_definitions/login.rb:13:in `/^the JSON response should be:$/'
You can run again with --guess to make Cucumber be more smart about it
(Cucumber::Ambiguous)
features/login.feature:17:in `And the JSON response should be:'
Failing Scenarios:
cucumber features/login.feature:7 # Scenario: I login as an valid user
1 scenario (1 failed)
4 steps (1 failed, 3 passed)
0m0.158s
I removed colons(:) in the scenario and the corrsponding step_definision, then it passed. Although I can use cucumber --guess
to make this scenario pass but I just don't like it. I'm not sure if the colon really matters but seemed it affects cucumber a bit.
Feature: Login
In order to login
As an API client
I want to login as a valid user
Scenario: I login as an valid user # features/login.feature:7
Given User "user" exists with password "password" and id "1" # features/step_definitions/login.rb:1
When I send a POST request to "/api/v1/login" with the following # features/step_definitions/login.rb:5
"""
{
"name":"user",
"password":"password"
}
"""
Then the response status should be "200" # features/step_definitions/login.rb:9
And the JSON response should be # features/step_definitions/login.rb:13
"""
{
"user_id": 1
}
"""
1 scenario (1 passed)
4 steps (4 passed)
0m0.158s