Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

".WARNING: Tried to inspect exception outside of Pry::rescue{ }" when trying to use from non-rails minitest test #58

Open
andreashappe opened this issue Feb 7, 2014 · 0 comments

Comments

@andreashappe
Copy link

Hi,
I'm using minitest for doing web testing (for external sites) and want to use pry-rescue for this.

So far I'm running into problems:

# Running tests:
..test 001
.test 002
.WARNING: Tried to inspect exception outside of Pry::rescue{ }
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:202:in `assert'
/home/andy/workspace/pen-test-capy/examples/pry_test.rb:10:in `test_pry_interactive_debugger'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1265:in `run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/minitest.rb:12:in `block in run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/interception-0.3/lib/interception.rb:71:in `call'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/interception-0.3/lib/interception.rb:71:in `listen'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:74:in `enable_rescuing!'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:94:in `with_rescuing'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:15:in `block (2 levels) in rescue'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:13:in `catch'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:13:in `block in rescue'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:12:in `loop'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/core_ext.rb:12:in `rescue'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pry-rescue-1.1.1/lib/pry-rescue/minitest.rb:11:in `run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:940:in `block in _run_suite'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:933:in `map'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:933:in `_run_suite'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:914:in `block in _run_suites'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:914:in `map'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:914:in `_run_suites'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:884:in `_run_anything'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1092:in `run_tests'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1079:in `block in _run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1078:in `each'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1078:in `_run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1066:in `run'
/home/andy/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:802:in `block in autorun'
F

My setup is a very simple Rakefile:

require 'rubygems'
require 'bundler/setup'
require 'rake/testtask'

Rake::TestTask.new do |t|
  t.test_files = FileList['examples/**/*.rb']
end

The failing test would be:

require_relative 'test_helper'

class PryTest < PenTest::TestCase

  def setup
    Capybara.app_host = 'http://snikt.net'
  end

  def test_pry_interactive_debugger
    assert false
  end
end

with "test_helper.rb" being:

require 'minitest/autorun'
require 'pry-rescue/minitest'

require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'

require 'minitest/colorize'

# Capybara and poltergeist configuration
Capybara.default_driver = :poltergeist
Capybara.run_server = false

module PenTest
  class TestCase < MiniTest::Unit::TestCase
    include Capybara::DSL
  end
end

Could you help me? What am I doing wrong?

thanks in advance, Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant