Sha256: 956545bd9ae8ac1e55d4b7d33dca05dd00468bba2a4dbd71dfbf22197417ecf2

Contents?: true

Size: 1.72 KB

Versions: 22

Compression:

Stored size: 1.72 KB

Contents

require_relative 'test_helper'

describe "Restart Command" do
  include TestDsl
  temporary_change_method_value(Debugger, :printer, Printers::Xml.new)
  let(:initial_dir) { Pathname.new(__FILE__ + "/../..").realpath.to_s }
  let(:prog_script) do
    Pathname.new(fullpath('restart')).relative_path_from(Pathname.new(Debugger::INITIAL_DIR)).cleanpath.to_s
  end
  let(:rdebug_script) { 'rdebug-script' }

  describe "messaging" do
    before do
      enter 'restart'
      force_set_const(Debugger, "INITIAL_DIR", initial_dir)
      force_set_const(Debugger, "PROG_SCRIPT", prog_script)
      force_set_const(Debugger, "RDEBUG_SCRIPT", rdebug_script)
      Debugger::Command.settings[:argv] = ['argv']
      Debugger::RestartCommand.any_instance.stubs(:exec).with("#{rdebug_script} argv")
    end

    describe "reexecing" do
      it "must show a message about reexecing" do
        debug_file('restart')
        check_output_includes "<restart command=\"#{rdebug_script} argv\"/>"
      end
    end

    describe "no script is specified and don't use $0" do
      before do
        Debugger.send(:remove_const, "PROG_SCRIPT")
        force_set_const(Debugger, "DEFAULT_START_SETTINGS", init: false, post_mortem: false, tracing: nil)
      end

      it "must show an error message" do
        debug_file('restart')
        check_output_includes "<error>Don't know name of debugged program</error>", interface.error_queue
      end
    end

    describe "no script at the specified path" do
      before { force_set_const(Debugger, "PROG_SCRIPT", 'blabla') }

      it "must show an error message" do
        debug_file('restart')
        check_output_includes "<error>Ruby program blabla doesn't exist</error>", interface.error_queue
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
debugger-xml-0.5.0.pre2 test/restart_test.rb
debugger-xml-0.5.0.pre1 test/restart_test.rb
debugger-xml-0.4.1 test/restart_test.rb
debugger-xml-0.4.0 test/restart_test.rb
debugger-xml-0.3.3 test/restart_test.rb
debugger-xml-0.3.2 test/restart_test.rb
debugger-xml-0.3.1 test/restart_test.rb
debugger-xml-0.2.0 test/restart_test.rb
debugger-xml-0.1.9 test/restart_test.rb
debugger-xml-0.1.8 test/restart_test.rb
debugger-xml-0.1.7 test/restart_test.rb
debugger-xml-0.1.6 test/restart_test.rb
debugger-xml-0.1.5 test/restart_test.rb
debugger-xml-0.1.4 test/restart_test.rb
debugger-xml-0.1.3 test/restart_test.rb
debugger-xml-0.1.2 test/restart_test.rb
debugger-xml-0.1.1 test/restart_test.rb
debugger-xml-0.1.0 test/restart_test.rb
debugger-xml-0.0.4 test/restart_test.rb
debugger-xml-0.0.3 test/restart_test.rb