Sha256: 30f5fabfc79a480f6cdc1e24689f1c49a3e2bd84f2c0749ed7e86a644f99ac0d

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 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] = "#{File.dirname(__FILE__)}/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

6 entries across 6 versions & 1 rubygems

Version Path
knife-solo-0.7.0 test/support/test_case.rb
knife-solo-0.7.0.pre3 test/support/test_case.rb
knife-solo-0.7.0.pre2 test/support/test_case.rb
knife-solo-0.7.0.pre test/support/test_case.rb
knife-solo-0.6.0 test/support/test_case.rb
knife-solo-0.5.1 test/support/test_case.rb