1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/commands/jump_to_spec.rb
Josh Cheek bf24df0cf1 Refactor jump_to and spec
Update jump_to command's spec to RSpec 3 (https://github.com/pry/pry/issues/1294)
Perform some refactorings along the way.
2014-09-01 02:41:43 -06:00

18 lines
602 B
Ruby

require 'helper'
RSpec.describe "jump-to" do
let(:obj) { Object.new }
it 'jumps to the proper binding index in the stack' do
expect(pry_eval obj, "cd 1", "cd 2", "jump-to 0", 'self').to eq obj
expect(pry_eval obj, 'cd 1', 'cd 2', 'jump-to 1', 'self').to eq 1
end
it 'prints an error when trying to jump to the same binding index' do
expect(pry_eval obj, "cd 1", "cd 2", "jump-to 2").to match /Already/
end
it 'prints error when trying to jump to a non-existent binding index' do
expect(pry_eval obj, "cd 1", "cd 2", "jump-to 3").to match /Invalid nest level/
end
end