summaryrefslogtreecommitdiff
path: root/spec/commands/bang_spec.rb
blob: e07964ec613b8fe58ae48c4348ab7dbc6d63bc0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

describe "!" do
  before do
    @t = pry_tester
  end

  it 'should correctly clear the input buffer ' do
    @t.push unindent(<<-STR)
      def hello
        puts :bing
    STR

    @t.process_command '!'
    expect(@t.last_output).to match(/Input buffer cleared!/)
    expect(@t.eval_string).to eq('')
  end

  it 'should not clear the input buffer for negation' do
    @t.push '! false'
    expect(@t.last_output).to match(/true/)
    expect(@t.eval_string).to eq('')
  end
end