0
指定路徑我已經設置了這種黃瓜功能在「spree_fit_card/new_gift_card.feature`:如何黃瓜
@gift-card
Feature: access gift cards
As a general user
I will be able to place an order for a gift card
Scenario: The gift card index page will redirect to /new
When I am on the gift card page
Then I will be redirected to the new gift card page
而在support/paths.rb
:
module NavigationHelpers
def path_to(page_name)
when /the gift card page/
spree.gift_cards_path
when /the new gift card page/
spree.new_gift_card_path
else
...
end
end
end
而當我們取出step_definitions/new_gift_card_steps.rb
:
When(/^I am on the gift card page$/) do
pending
end
Then(/^I will be redirected to the new gift card page$/) do
pending
end
黃瓜產量:
$ zeus cucumber --tags @gift-card
Loading fixtures
Using the default profile...
@gift-card
Feature: access gift cards
As a general user
I will be able to place an order for a gift card
Scenario: The gift card page will redirect to the new gift card page # features/spree_gift_card/new_gift_card.feature:6
When I am on the gift card page # features/spree_gift_card/new_gift_card.feature:7
Ambiguous match of "I am on the gift card page":
features/step_definitions/spree_gift_card/new_gift_cards_steps.rb:1:in `/^I am on the gift card page$/'
cucumber-websteps-0.10.0/lib/cucumber/websteps/browsing_steps.rb:1:in `/^(?:|I)am on (.+)$/'
You can run again with --guess to make Cucumber be more smart about it
(Cucumber::Ambiguous)
-e:1:in `<main>'
features/spree_gift_card/new_gift_card.feature:7:in `When I am on the gift card page'
Then I will be redirected to the new gift card page # features/step_definitions/spree_gift_card/new_gift_cards_steps.rb:5
Failing Scenarios:
cucumber features/spree_gift_card/new_gift_card.feature:6 # Scenario: The gift card page will redirect to the new gift card page
所以我把黃瓜的建議考慮跑zeus cucumber --tags @gift-card --guess
Loading fixtures
Using the default profile...
@gift-card
Feature: access gift cards
As a general user
I will be able to place an order for a gift card
Scenario: The gift card page will redirect to the new gift card page # features/spree_gift_card/new_gift_card.feature:6
When I am on 'the gift card page' # features/step_definitions/spree_gift_card/new_gift_cards_steps.rb:1
TODO (Cucumber::Pending)
./features/step_definitions/spree_gift_card/new_gift_cards_steps.rb:2:in `/^I am on the gift card page$/'
features/spree_gift_card/new_gift_card.feature:7:in `When I am on the gift card page'
Then I will be redirected to the new gift card page # features/step_definitions/spree_gift_card/new_gift_cards_steps.rb:5
1 scenario (1 pending)
2 steps (1 skipped, 1 pending)
0m0.016s
Cleaning up database
我很高興,它通過與--guess
,但我不明白爲什麼它不及格,沒有它。我想我已經設定好了,但我顯然沒有。如果它對Ruby on Rails 3.2.17版有幫助,我正在使用Spree框架。
我的回答對你的問題有何啓示? – Danny