Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stack level too deep (SystemStackError)

I have Sinatra application and need to test my application.

features/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

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
    Given I have opened homepage    
    Then I should see site header

Test it:

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 have created features/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

Test it:

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 dissapeared if I rewrite my env.rb like this:

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
like image 664
ceth Avatar asked Mar 31 '12 10:03

ceth


1 Answers

i was getting the same look alike 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..

i added require 'cucumber/rails' on first line of env.rb...which get loaded first.

Now no more im facing that error.

like image 113
Milind Avatar answered Oct 14 '22 11:10

Milind