2012-03-31 7 views
6

У меня есть приложение 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 так:

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 
+0

Вы можете оставить Gemfile.lock также и тем более какие версии огурца, водосвинки и RSpec вы используете – Dan

+0

я разместил мои Gemfile.lock здесь: http://pastebin.com/8Ni5MSdj – demas

+0

@Jacob, Rspec является для утверждений, в то время как Capybara просто разговаривает с веб-драйвером. С учетом сказанного вам определенно нужны как Rspec & Capybara (и, вероятно, Selenium тоже) –

ответ

0

Я считаю, что только Capybara.app = Applicationне должны быть объявлены внутри World, как показано в вашем примере.

Так вот мой рабочей env.rb:

ENV['RACK_ENV'] = 'test' 
require File.join(File.dirname(__FILE__), '..', '..', 'rvs.rb') 

require 'capybara' 
require 'capybara/cucumber' 
require 'rspec' 
require 'r18n-core' 

Capybara.app = RVS 

class RVSWorld 
    include R18n::Helpers 
    include Capybara::DSL 
    include RSpec::Expectations 
    include RSpec::Matchers 
end 

World do 
    RVSWorld.new 
end 

Как вы можете видеть RVSWorld класс имеет только заявление, которые включают в себя необходимые модули.

1

я получаю то же самое похож error..as

stack level too deep (SystemStackError) 
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/cucumber-1.1.4/lib/cucumber/core_ext/instance_exec.rb:73.. 

я добавил require 'cucumber/rails' на первой линии env.rb ... которые загружаются первым.

Теперь больше не сталкиваются с этой ошибкой.

Смежные вопросы