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

How to debug your code not RSpec?? #103

Open
marko-avlijas opened this issue Nov 12, 2016 · 2 comments
Open

How to debug your code not RSpec?? #103

marko-avlijas opened this issue Nov 12, 2016 · 2 comments

Comments

@marko-avlijas
Copy link

marko-avlijas commented Nov 12, 2016

I guess a guide how to use this effectively is needed.
It seems this gem just rescues exception but doesn't help at all with debugging it?

I started with this:

From: /data/sites/scripts/sw_scripts/ruby/gallery/spec/specs/specs_spec.rb @ line 161 :

	156:       include_examples 'single unit type', :hp, 'HP', 0
	157:     end
	158: 
	159:     describe ':hp_per_volume' do
	160:       it 'tyring to set value/unit raises CantSetCompoundUnitError' do
 => 161:         expect {
	162:           subject.hp_per_volume = 10
	163:         }.to raise_error(CantSetCompoundUnitError)
	164:         expect {
	165:           subject.hp_per_volume = 10, 'HP/Liter'
	166:         }.to raise_error(CantSetCompoundUnitError)

RSpec::Expectations::ExpectationNotMetError: expected Specs::CantSetCompoundUnitError but nothing was raised
from /home/marko/.gem/ruby/2.3.1/gems/rspec-support-3.5.0/lib/rspec/support.rb:87:in `block in <module:Support>'
[1] pry(#<RSpec::ExampleGroups::SpecsSpecs::AttributesNotNeedingConversion::HpPerVolume>)>

I want to examine my code subject.hp_per_volume = 10
But when I press n I get thrown into a nasty spiral of RSpec internals. How do I get it to skip RSpec stuff I don't care about and move to my code?

Because this is the response I get when I press n (which should skip over not step into like s)

UncaughtThrowError: uncaught throw :breakout_nav
from /home/marko/.gem/ruby/2.3.1/gems/pry-byebug-3.4.0/lib/pry-byebug/helpers/navigation.rb:13:in `throw'

Frame number: 0/43
Frame type: method

From: /home/marko/.gem/ruby/2.3.1/gems/pry-0.10.4/lib/pry/pry_instance.rb @ line 529 Pry#select_prompt:

    524:   end
    525: 
    526:   # Returns the appropriate prompt to use.
    527:   # @return [String] The prompt.
    528:   def select_prompt
 => 529:     object = current_binding.eval('self')
    530: 
    531:     open_token = @indent.open_delimiters.any? ? @indent.open_delimiters.last :
    532:       @indent.stack.last
    533: 
    534:     c = Pry::Config.from_hash({

NoMethodError: private method `eval' called for nil:NilClass
from /home/marko/.gem/ruby/2.3.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:529:in `select_prompt'
[1] pry(#<Pry>)> 

What is all this nonsense? How to get to your code? How to debug your code not RSpec?

@PhilT
Copy link

PhilT commented Apr 19, 2017

did you also add the pry-stack_explorer gem? That seemed to fix it for me.

@cyrilchampier
Copy link

we also have the pry-stack_explorer and experience the same pb

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

3 participants