tags:

views:

184

answers:

1

Hi, I'm setting up my Authlogic user session features. And I'm in some kind of confusion. When I run:

cucumber features

I get some red errors

     Scenario: User signs in successfully                           # features/user_sessions.feature:21
        Given a user exists with login: "sachin", password: "secret" # features/step_definitions/pickle_steps.rb:4
        When I go to the login page                                  # features/step_definitions/webrat_steps.rb:15
        And I login as "sachin" with password "secret"               # features/step_definitions/user_session_setps.rb:5
        Then I should see "Login successful"                         # features/step_definitions/webrat_steps.rb:123
        And I should be logged in                                    # features/user_sessions.feature:26
          Ambiguous match of "I should be logged in":

          features/step_definitions/pickle_steps.rb:55:in `/^((?:(?:I|myself|me|my)|(?:(?:a|an|another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?(?:user))|(?:(?:user)(?::? "(?:[^\"]|\.)*"))))) should (?:be|have) (?:an? )?((?:duplicable|readonly|nil|store[_ ]full[_ ]sti[_ ]class|new[_ ]record|equal|present|eql|marked[_ ]for[_ ]destruction|valid[_ ]password|valid[_ ]with[_ ]callbacks|logged[_ ]in|valid[_ ]without[_ ]callbacks|respond[_ ]to[_ ]without[_ ]attributes|valid|logged[_ ]out|respond[_ ]to|instance[_ ]variable[_ ]defined|admin|blank|changed|tainted|unserializable[_ ]attribute|locking[_ ]enabled|has[_ ]role|instance[_ ]of|partial[_ ]updates|kind[_ ]of|attribute[_ ]present|is[_ ]a|frozen|invalid|acts[_ ]like|method[_ ]exists|has[_ ]attribute|disable[_ ]perishable[_ ]token[_ ]maintenance|is[_ ]haml|id|created[_ ]at|updated[_ ]at|login|crypted[_ ]password|password[_ ]salt|persistence[_ ]token|login[_ ]count|last[_ ]request[_ ]at|last[_ ]login[_ ]at|current[_ ]login[_ ]at|last[_ ]login[_ ]ip|current[_ ]login[_ ]ip|roles|first[_ ]name|last[_ ]name|perishable[_ ]token|email))$/'
          features/step_definitions/user_session_setps.rb:13:in `/^I should be logged in$/'

          You can run again with --guess to make Cucumber be more smart about it
           (Cucumber::Ambiguous)
          features/user_sessions.feature:26:in `And I should be logged in'

    Failing Scenarios:
    cucumber features/user_sessions.feature:7 # Scenario: User is not signed up
    cucumber features/user_sessions.feature:14 # Scenario: User enters wrong password
    cucumber features/user_sessions.feature:21 # Scenario: User signs in successfully

And as cucumber suggests, and when I run with --guess option:

cucumber features --guess

All come green and passes. Is this the expected behavior or error??

+1  A: 

AFAIK, if you have 2 different step definitions that are the same, Cucumber does not know which one to run. Using the --guess flag forces Cucumber to pick the most likely one. The cucumber rake tasks use the --strict flag, and will fail if you have ambigious steps.

Essectially, you need to consider the 2 steps (one in pickle steps and one in user_session_steps) that are conflicting and make a decision as to which one to use, then delete the other one.

Rodreegez