我有Sinatra應用程序,需要測試我的應用程序。堆棧層面太深(SystemStackError)
功能/支持/ env.rb:
require_relative "../../application"
require "capybara"
require "capybara/cucumber"
require "rspec"
World do
Capybara.app = Application
include Capybara::DSL
include RSpec::Matchers
end
功能/ one.feature:
Feature: Test homepage
In order to make sure people can open my site
I want to check it opened
Scenario: Opening first page
Given I have opened homepage
Then I should see site header
測試:
cucumber features\one.feature
結果:
Feature: Test homepage
In order to make sure people can open my site
I want to check it opened
Scenario: Opening first page # features\one.feature:5
Given I have opened homepage # features\one.feature:6
Then I should see site header # features\one.feature:7
1 scenario (1 undefined)
2 steps (2 undefined)
0m0.006s
You can implement step definitions for undefined steps with these snippets:
Given /^I have opened homepage$/ do
pending # express the regexp above with the code you wish you had
end
Then /^I should see site header$/ do
pending # express the regexp above with the code you wish you had
end
好了,我已經創建功能/ step_definitions/agenda_steps.rb:
Given /^I have opened homepage$/ do
pending # express the regexp above with the code you wish you had
end
Then /^I should see site header$/ do
pending # express the regexp above with the code you wish you had
end
測試:
cucumber features\one.feature
結果:
Feature: Test homepage
In order to make sure people can open my site
I want to check it opened
Scenario: Opening first page # features\one.feature:5
Given I have opened homepage # features/step_definitions/agenda_steps.rb:1
C:/Ruby193/bin/cucumber:19: stack level too deep (SystemStackError)
爲什麼和如何我可以修復它嗎?
更新時間:如果我重寫我的env.rb這樣dissapeared問題:
require_relative "../../application"
require "capybara"
require "capybara/cucumber"
require "rspec"
Capybara.app = Application
#World do
# Capybara.app = Application
#
# include Capybara::DSL
# include RSpec::Matchers
#end
你可以發佈你的Gemfile.lock還是更多,所以你使用的是什麼版本的黃瓜,水豚和rspec – Dan 2012-03-31 11:03:19
我已經發布我的Gemfile.lock在這裏:http://pastebin.com/8Ni5MSdj – demas 2012-03-31 11:13:09
@Jacob,Rspec是對於斷言而水豚只是與網絡驅動程序交談。據說,你一定需要Rspec和水豚(也可能是Selenium) – 2013-06-12 20:57:52