pry / pry-stack_explorer

Walk the stack in a Pry session

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error using pry inside RSpec's `expect{}.to change` blocks

hosamaly opened this issue · comments

Calling binding.pry from inside an expect {}.to change block causes the following error:

when_started hook failed: NoMethodError: undefined method `call' for Pry:Class
[...]/rspec-expectations-2.11.3/lib/rspec/matchers/built_in/change.rb:16:in `matches?'
(see _pry_.hooks.errors to debug)

A minimal RSpec example causing the error is:

require 'spec_helper'
require 'pry'

describe Pry do
  it 'should not throw an exception when called inside expect{} block' do
    x = []
    expect {
      binding.pry
    }.not_to change(x, :size)
  end
end

Using a rails application with the following gems added to the Gemfile:

gem 'rspec-rails'       , '2.11.0'
gem 'pry-rails'         , '0.2.1'
gem 'pry-debugger'      , '0.2.0'
gem 'pry-stack_explorer', '0.4.6'

Removing the pry-stack_explorer gem from the Gemfile fixes the error, so it is probably related to this gem.

Looks like this has been fixed by fate, just tried the test case. Reopen if needed!