Sha256: b55d469d81e3afa9411e0650617016960305bcfa65e4f6f1a6c298952807962a

Contents?: true

Size: 879 Bytes

Versions: 3

Compression:

Stored size: 879 Bytes

Contents

#!/usr/bin/env ruby
require_relative './mock-helper'
require_relative './cmd-helper'
require_relative '../../processor/command/edit'

class TestCommandEdit < Test::Unit::TestCase
  include MockUnitHelper
  def setup
    @name = File.basename(__FILE__, '.rb').split(/-/)[2]
    $msgs = []
    $errmsgs = []
    common_setup(@name)
    def @cmd.msg(message)
      $msgs << message
    end
    def @cmd.errmsg(message)
      $errmsgs << message
    end
  end

  def test_basic
    old_editor = ENV['EDITOR']
    ENV['EDITOR'] = '#'
    base_file = File.basename(__FILE__)
    @cmd.proc.settings[:basename] = true
    @cmd.run([@name])
    assert_equal "Running # +39 \"edit.rb\"...", $msgs[-1]
    @cmd.run([@name, 7])
    assert_equal "Running # +7 \"edit.rb\"...", $msgs[-1]
    @cmd.run([@name, __FILE__])
    assert_equal "Running # +1 \"#{base_file}\"...", $msgs[-1]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trepanning-0.1.6 test/unit/test-cmd-edit.rb
trepanning-0.1.4 test/unit/test-cmd-edit.rb
trepanning-0.1.3 test/unit/test-cmd-edit.rb