Sha256: e92d6aab670a496b47c94b54a69bad5890c6b3d3881281d63cffe9db1f1782f2

Contents?: true

Size: 981 Bytes

Versions: 77

Compression:

Stored size: 981 Bytes

Contents

require 'helper'

describe "exit" do
  it 'should pop a binding with exit' do
    pry_tester(:outer).simulate_repl do |t|
      t.eval 'cd :inner'
      t.eval('self').should == :inner
      t.eval 'exit'
      t.eval('self').should == :outer
      t.eval 'exit-all'
    end
  end

  it 'should break out of the repl loop of Pry instance when binding_stack has only one binding with exit' do
    pry_tester(0).simulate_repl do |t|
      t.eval 'exit'
    end.should == nil
  end

  it 'should break out of the repl loop of Pry instance when binding_stack has only one binding with exit, and return user-given value' do
    pry_tester(0).simulate_repl do |t|
      t.eval 'exit :john'
    end.should == :john
  end

  it 'should break out the repl loop of Pry instance even after an exception in user-given value' do
    pry_tester(0).simulate_repl do |t|
      proc {
        t.eval 'exit = 42'
      }.should.raise(SyntaxError)
      t.eval 'exit'
    end.should == nil
  end
end

Version data entries

77 entries across 77 versions & 5 rubygems

Version Path
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_spec.rb
pry-0.9.12.6 spec/commands/exit_spec.rb
pry-0.9.12.6-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.12.6-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.12.6-java spec/commands/exit_spec.rb
pry-0.9.12.5 spec/commands/exit_spec.rb
pry-0.9.12.5-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.12.5-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.12.5-java spec/commands/exit_spec.rb
pry-0.9.12.4 spec/commands/exit_spec.rb
pry-0.9.12.4-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.12.4-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.12.4-java spec/commands/exit_spec.rb
pry-0.9.12.3 spec/commands/exit_spec.rb
pry-0.9.12.3-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.12.3-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.12.3-java spec/commands/exit_spec.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/pry-0.9.12-java/spec/commands/exit_spec.rb
sshp-0.0.2 vendor/ruby/1.9.1/gems/pry-0.9.12.2/spec/commands/exit_spec.rb
sshp-0.0.1 vendor/ruby/1.9.1/gems/pry-0.9.12.2/spec/commands/exit_spec.rb