Search code examples
ruby-on-railsprypry-rails

Binding pry not being called in test environment


I'm currently writing specs for my Rails controller. I can't seem to get any puts statement or binding.pry, or binding.remote_pry working.

I am able to get the remote pry working in the development environment.

group :development, :test do
  gem 'rspec-rails', '~> 3.0'
  gem 'capybara'
  gem 'factory_girl_rails'
  gem 'daemons'
  gem 'pry-rails'
  gem 'pry-remote'
  gem 'binding_of_caller'
end

Solution

  • It seems that you need to require 'pry' somewhere in your test environment before invoking it. Your spec_helper.rb, test_helper.rb or similar is probably a good place.