Sha256: 7d6200dc5232f172709a90c0009b3afd0857ad18344a5246c3775324788ff9c2

Contents?: true

Size: 689 Bytes

Versions: 10

Compression:

Stored size: 689 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(:err)
    Chef::Config[:verbosity] = 0
    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

10 entries across 10 versions & 1 rubygems

Version Path
knife-solo-0.4.3 test/support/test_case.rb
knife-solo-0.4.2 test/support/test_case.rb
knife-solo-0.4.1 test/support/test_case.rb
knife-solo-0.4.0 test/support/test_case.rb
knife-solo-0.3.0 test/support/test_case.rb
knife-solo-0.3.0.pre5 test/support/test_case.rb
knife-solo-0.3.0.pre4 test/support/test_case.rb
knife-solo-0.3.0.pre3 test/support/test_case.rb
knife-solo-0.3.0.pre2 test/support/test_case.rb
knife-solo-0.3.0.pre1 test/support/test_case.rb