Stack Level Too High (SystemStackError)

I have a Sinatra application and need to check my application.

functions / support / 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 features:

 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 

Check this:

 cucumber features\one.feature 

Result:

 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 

Well, I created the functions / 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 

Check this:

 cucumber features\one.feature 

Result:

 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) 

Why and how can I fix it?

Updated: the problem disappeared if I rewrote my env.rb as follows:

 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 
+6
source share
2 answers

I was getting the same similar error.

 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.. 

I added require 'cucumber/rails' to the first line of env.rb ... which are loaded first.

Now there are no more problems with this error.

+1
source

I believe that only Capybara.app = Application should not be declared inside World as shown in your example.

So here is my env.rb job:

 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 

As you can see, the RVSWorld class contains only instructions containing the necessary modules.

0
source

Source: https://habr.com/ru/post/912109/


All Articles