File: run_command_spec.rb

package info (click to toggle)
pry 0.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,788 kB
  • sloc: ruby: 21,638; sh: 17; makefile: 11
file content (23 lines) | stat: -rw-r--r-- 623 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

describe "Pry.run_command" do
  before do
    o = Object.new
    def o.drum
      "roken is dodelijk"
    end
    @context = Pry.binding_for(o)
  end

  it 'performs a simple ls' do
    @context.eval("hokey_pokey = 10")
    Pry.run_command "ls", context: @context, output: out = StringIO.new
    expect(out.string).to match(/hokey_pokey/)
  end

  # This is a regression test as 0.9.11 broke this behaviour
  it 'can perform a show-source' do
    Pry.run_command "show-source drum", context: @context, output: out = StringIO.new
    expect(out.string).to match(/roken is dodelijk/)
  end
end