It's possible to start a REPL session passing a command?
Closed this issue · 1 comments
Hi there, I hope you are doing well.
This is a question (and a suggestion of feature).
I have added an alias on RSpec using pry-byebug
, just like this:
# frozen_string_literal: true
RSpec.configure do |rspec|
rspec.alias_example_group_to :pcontext, pry: true
rspec.alias_example_group_to :pdescribe, pry: true
rspec.alias_example_to :pit, pry: true
rspec.before(:example, pry: true) do |_|
# rubocop:disable Lint/Debugger
binding.pry
# rubocop:enable Lint/Debugger
end
end
I would like that when using this alias, for example in this line of code:
pit { expect(published_post.published?).to be_truthy }
To session start at the line of the test:
...
=> 16: pit { expect(published_post.published?).to be_truthy }
And not on the alias:
From: /opt/hobbyonrails/spec/support/alias.rb:12 :
7:
8: rspec.before(:example, pry: true) do |_|
9: # rubocop:disable Lint/Debugger
10: binding.pry
11: # rubocop:enable Lint/Debugger
=> 12: end
13: end
To go to the line that I want I need to run this command: step 25
. So, I was wondering if there is a way to make this command be executed after the session is started?
Like passing the command as a block, for example:
binding.pry { |_| step 25 }
If there is no way to achieve this and if you think this feature makes sense I would like to make this contribution. If not, I understand and maybe I will create a gem to achieve this.
Thank you for your attencion.
Reading this again, it looks like the right place is StackOverFlow. Thank you anyway