Sha256: ff336e0d6c8fe905dfed47db1526b57f97cb28c76a72dfe4f4f629a8d3adcbd5

Contents?: true

Size: 747 Bytes

Versions: 1

Compression:

Stored size: 747 Bytes

Contents

class TestCase < MiniTest::Unit::TestCase
  def default_test
    super unless self.class == TestCase
  end

  def write_file(file, contents)
    FileUtils.mkpath(File.dirname(file))
    File.open(file, 'w') { |f| f.print contents }
  end

  def knife_command(cmd_class, *args)
    cmd_class.load_deps
    command = cmd_class.new(args)
    command.ui.stubs(:msg)
    command.ui.stubs(:warn)
    Chef::Config[:verbosity] = 0
    command.config[:config_file] = "#{__dir__}/knife.rb"
    command.configure_chef
    command
  end

  # Assert that the specified command or block raises SystemExit
  def assert_exits(command = nil)
    assert_raises SystemExit do
      if command
        command.run
      else
        yield
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knife-solo-0.5.0 test/support/test_case.rb