Infinite recursion when using #select #63

Closed
iconara opened this Issue Apr 1, 2010 · 4 comments

Comments

Projects
None yet
2 participants

iconara commented Apr 1, 2010

require 'rubygems'
require 'capybara'
require 'capybara/dsl'

include Capybara

Capybara.default_driver = :selenium
Capybara.app_host       = 'http://slask.iconara.net'
Capybara.run_server     = false

visit('/capybara-infinite-recursion.html')

select('No', :from => 'Will this work?')

With Capybara 0.3.6 running the above script yields this error when the last line is run:

/Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:84:in `select': stack level too deep (SystemStackError)
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:85:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:85:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:85:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:85:in `select'
     ... 2176 levels...
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/session.rb:85:in `select'
    from /Library/Ruby/Gems/1.8/gems/capybara-0.3.6/lib/capybara/dsl.rb:55:in `select'
    from bug.rb:13

iconara commented Apr 4, 2010

I should add that you can run the script above as is, the URL exists, and points to a minimal HTML page with more or less only a label and a select tag.

Collaborator

jnicklas commented Apr 9, 2010

don't suggest including Capybara in the global object, closed by 360088a

Collaborator

jnicklas commented Apr 9, 2010

It's generally not a good idea to include things in the global object. I did this in the README as an example, which probably wasn't so smart. The README has been changed.

iconara commented Apr 9, 2010

That explains it. However, I see nothing wrong with including things in the global scope in a simple script like the one above, especially when using a DSL.

johnf pushed a commit to johnf/capybara that referenced this issue Oct 17, 2011

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment