How to examine rspec variables with pry debugger
To use pry in specs we need to add require 'pry'
within the spec_helper.rb file. Then we are able to use binding.pry within any of the specs.
This should work:
describe 'happenings' do
context "#index (GET /api/v1/flat_happenings.json)" do
before(:each) do
30.times { FactoryGirl.create(:flat_happening) }
get "/api/v1/flat_happenings.json"
end
it "should list all flat_happenings" do
binding.pry
JSON.parse(response.body)["flat_happenings"].length.should eq 30
end
end
end
HTH
You should place binding.pry
inside it
block.