2011-03-27 51 views
0

我使用的铁轨2.3.5与 黄瓜(0.10.0) 黄瓜导轨(0.3.2) 水豚(0.4.1.2) rspec的(2.5 .0) rspec的核心(2.5.1) rspec的期许(2.5.0) rspec的-嘲笑(2.5.0) RSpec的护栏(2.5.0)黄瓜:命令失败,状态(1)用耙子功能

我有这种情况

特征:用户登录

Scenario: User sees the admin login page 
    Given There exists an admin login page 
    When I visit the admin login page 
    Then she should see the "login , Password" fields 
    And she should see links to "Forgot Password? , Do not have an account?" 

而且

Given /^There exists an admin login page$/ do 
    Capybara.default_host = "admin.local" 
    Capybara.app_host = "http://admin.local:9887" if Capybara.current_driver == :selenium 
end 

When /^I visit the admin login page$/ do 
    visit ('/') 
end 


Then /^she should see the "([^"]*)" fields$/ do |fields| 
    fields.split(/,/).each do |field| 
    page.should have_xpath("//*[@id='user_session_#{field.downcase.strip}']") 
    end 
end 

Then /^she should see links to "([^"]*)"$/ do |links| 
    links.split(/,/).each do |link_name| 
    page.should have_content(link_name.strip) 
    end 
end 

如图所示的网络的步骤我有我的管理控制台映射为一个子域我的网页几步之遥。

我面临的问题是当我运行这个场景使用cucumber-f pretty所有的步骤通过和整体情况看起来不错。

但是当我做耙功能或耙黄瓜:我得到这个错误如下(我张贴与跟踪误差)

$ rake features --trace --verbose 
** Invoke features (first_time) 
** Invoke cucumber (first_time) 
** Invoke cucumber:ok (first_time) 
** Invoke db:test:prepare (first_time) 
** Invoke db:abort_if_pending_migrations (first_time) 
** Invoke environment (first_time) 
** Execute environment 
** Execute db:abort_if_pending_migrations 
** Execute db:test:prepare 
** Invoke db:test:load (first_time) 
** Invoke db:test:purge (first_time) 
** Invoke environment 
** Execute db:test:purge 
** Execute db:test:load 
** Invoke db:schema:load (first_time) 
** Invoke environment 
** Execute db:schema:load 
** Execute cucumber:ok 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/bin/cucumber" --profile default 
Using the default profile... 
/Users/raghavendra/Projects/project/project/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement 
F----F 

Failing Scenarios: 
cucumber features/user_features/user_login_and_creation.feature:3 # Scenario: User sees the admin login page 

1 scenario (1 failed) 
4 steps (4 skipped) 
0m0.005s 
rake aborted! 
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...] 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh' 
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:72:in `run' 
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:142:in `define_task' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' 
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 
/usr/bin/rake:19:in `load' 
/usr/bin/rake:19 

任何想法或帮助将高度赞赏:)

回答

2

虽然我不确定这与您的问题完全相关,但RSpec 2.x仅适用于Rails 3.x。您将需要RSpec 1.3.x与rails 2.3.x一起使用。

1

当在cucumber.yml文件中定义了--strict时,如果有任何挂起或未定义的步骤,Cucumber会抛出非零回报。尝试---严格,看看是否适合你。