I'm debugging some cucumber scenarios for a rails app, and ruby-debug is not behaving the way I expect. I have a debugger statement at the top of one of my failing steps, and when I do some routine debugging activities in the resulting debugger prompt, the rake aborts and tosses me back to the terminal prompt.

/Users/mylogin/app/app/features/step_definitions/merchant_payment_steps.rb:103
Then "I should see \"form#payment-form\""
(rdb:1) p "HI"
"HI"
(rdb:1) p page.class
Capybara::Session
(rdb:1) p page.notamethod
NoMethodError Exception: undefined method `notamethod' for #<Capybara::Document>
(rdb:1) p page.has_content
NoMethodError Exception: undefined method `has_content' for #<Capybara::Document>
(rdb:1) p page.has_content?
ArgumentError Exception: wrong number of arguments (0 for 1)
(rdb:1) p page.has_content?("HI")
rake aborted!
Command failed with status (): [bundle exec /Users/mylogin/.rvm/rubies...]

(See full trace by running task with --trace)
mycomputer:app mylogin$

I'm not super familiar with ruby-debug, so if this is some elementary thing, go ahead and tell me to RTFM. I've tried starting irb from ruby-debug (irb being something I am intimately familiar with), and it behaves the same way given the same code. I'm struggling with what to Google to try and figure this out, so any help would be much appreciated. Thanks.

EDIT:

Here's the command with a stack trace (it's ugly):

MICHAELs-MacBook-Air:app michaelmaag$ bundle exec rake cucumber:wip FEATURE=features/manage_messages.feature --trace
(in /Users/michaelmaag/app/app)
** Invoke cucumber:wip (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
** Execute cucumber:wip
bundle exec /Users/michaelmaag/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -I "/Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib:lib" "/Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/bin/cucumber"  --profile wip features/manage_messages.feature
Using the wip profile...
Feature: In order to save users and merchants time
  Users and merchants
  Need to be able to text back and forth within Waiter d'

  @javascript @wip
  Scenario: Send user a message                                       # features/manage_messages.feature:8
    Given I press the "Bob" encounter                                   # features/step_definitions/message_steps.rb:10
/Users/michaelmaag/app/app/features/step_definitions/message_steps.rb:29
if encounter.find("div.encounter_name").text.strip == user_name
(rdb:1) p page.has_content?("HI")
INTERNAL ERROR!!! deadlock detected
    /Users/michaelmaag/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/thread.rb:185:in `sleep'
    /Users/michaelmaag/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/thread.rb:185:in `block in pop'
    <internal:prelude>:10:in `synchronize'
    /Users/michaelmaag/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/thread.rb:180:in `pop'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/command_executor.rb:33:in `execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/bridge.rb:101:in `raw_execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/bridge.rb:85:in `execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/remote/bridge.rb:442:in `find_elements_by'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/remote/bridge.rb:298:in `findElementsByXpath'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/common/find.rb:67:in `find_elements'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/driver/selenium_driver.rb:126:in `find'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:156:in `find_in_base'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:121:in `block in all'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `map'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `all'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/matchers.rb:38:in `block in has_selector?'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `block in wait_conditionally_until'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/session.rb:222:in `block in wait_until'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/util/timeout.rb:13:in `timeout'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/session.rb:222:in `wait_until'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `wait_conditionally_until'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/matchers.rb:37:in `has_selector?'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/matchers.rb:121:in `has_xpath?'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/node/matchers.rb:184:in `has_content?'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/session.rb:264:in `method_missing'
    /Users/michaelmaag/app/app/features/step_definitions/message_steps.rb:29:in `block (2 levels) in <top (required)>'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:174:in `eval'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:174:in `debug_eval'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:47:in `block in execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:19:in `run_with_binding'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/eval.rb:46:in `execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:275:in `one_cmd'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `each'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:260:in `block in process_commands'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `catch'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:253:in `process_commands'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:173:in `at_line'
    (eval):5:in `block in at_line'
    <internal:prelude>:10:in `synchronize'
    (eval):3:in `at_line'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:55:in `at_line'
    /Users/michaelmaag/app/app/features/step_definitions/message_steps.rb:29:in `block (2 levels) in <top (required)>'
    /Users/michaelmaag/app/app/features/step_definitions/message_steps.rb:27:in `each'
    /Users/michaelmaag/app/app/features/step_definitions/message_steps.rb:27:in `block in <top (required)>'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/rb_support/rb_step_definition.rb:62:in `invoke'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/step_match.rb:26:in `invoke'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/step_invocation.rb:63:in `invoke'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/step_invocation.rb:42:in `accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:99:in `block in visit_step'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/step_collection.rb:15:in `block in accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/step_collection.rb:14:in `each'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/step_collection.rb:14:in `accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:93:in `block in visit_steps'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/scenario.rb:53:in `block (2 levels) in accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:79:in `block (2 levels) in with_hooks'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:95:in `before_and_after'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:78:in `block in with_hooks'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:115:in `call'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:115:in `block (3 levels) in around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/language_support/language_methods.rb:13:in `block in around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/language_support/language_methods.rb:95:in `call'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/language_support/language_methods.rb:95:in `execute_around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/language_support/language_methods.rb:12:in `around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:114:in `block (2 levels) in around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:112:in `call'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime/support_code.rb:112:in `around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:90:in `around'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:77:in `with_hooks'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/scenario.rb:51:in `block in accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/scenario.rb:106:in `with_visitor'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/scenario.rb:45:in `accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:51:in `block in visit_feature_element'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:40:in `block in accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `each'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/feature.rb:39:in `accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:20:in `block in visit_feature'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:29:in `block in accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:17:in `each'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/features.rb:28:in `accept'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:14:in `block in visit_features'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:164:in `broadcast'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/runtime.rb:45:in `run!'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:43:in `execute!'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/lib/cucumber/cli/main.rb:20:in `execute'
    /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/cucumber-0.10.2/bin/cucumber:14:in `<main>'    And I press the message button for the "Bob" encounter            # features/step_definitions/message_steps.rb:25
      closed stream (IOError)
      ./features/step_definitions/message_steps.rb:29:in `block (2 levels) in <top (required)>'
      ./features/step_definitions/message_steps.rb:27:in `each'
      ./features/step_definitions/message_steps.rb:27:in `/^I press the message button for the "([^"]*)" encounter$/'
      features/manage_messages.feature:13:in `And I press the message button for the "Bob" encounter'
    When I press the view conversation button for the "Bob" encounter # features/step_definitions/message_steps.rb:39
    Then I should see a conversation between "Burst" and "Bob"        # features/step_definitions/message_steps.rb:52
      closed stream (IOError)
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/command_executor.rb:30:in `write'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/command_executor.rb:30:in `execute'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/bridge.rb:101:in `raw_execute'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/chrome/bridge.rb:85:in `execute'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/remote/bridge.rb:232:in `deleteAllCookies'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/selenium-webdriver-0.1.3/lib/selenium/webdriver/common/options.rb:67:in `delete_all_cookies'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/driver/selenium_driver.rb:141:in `reset!'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/session.rb:60:in `reset!'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/dsl.rb:69:in `block in reset_sessions!'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/dsl.rb:69:in `each'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/dsl.rb:69:in `reset_sessions!'
      /Users/michaelmaag/.rvm/gems/ruby-1.9.2-p290@stable/gems/capybara-0.4.1.2/lib/capybara/cucumber.rb:7:in `After'

Failing Scenarios:
cucumber -p wip features/manage_messages.feature:8 # Scenario: Send user a message

1 scenario (1 failed)
7 steps (1 failed, 2 skipped, 4 passed)
0m19.743s

The --wip switch was used, so the failures were expected. All is good.
1

There are 1 best solutions below

0
On

you are using Capybara to test your page and Capybara uses a html parser like hpricot or nokogiri to parse the html markup of the called page. The problem maybe a segmentation fault caused by the html parser. I experienced this problem several times. Try to run your test task with --trace to see the full stack trace.