Sha256: 9f84c23a0c033dea2b66b8238ba99800805dc8365a23af4956e4d23d53086e82

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

require 'test_helper'
require 'solusvm/cli'

class TestGeneralCLI < Test::Unit::TestCase

  def setup
    # Prevents mocha from stubbing non existent methods so that we now if the CLI is failing because
    # something was moved around.
    Mocha::Configuration.prevent(:stubbing_non_existent_method)
  end

  def test_should_delegate_templates_to_general
    SolusVM::General.expects(:new).with(solusvm_params).returns(mock do
      expects(:successful?).returns(true)
      expects(:templates).with("type").returns("thetemplates")
    end)

    out = capture_stdout do
      SolusVM::CLI.start(cli_expand_base_arguments(["general", "templates", "type"]))
    end
    assert_match "thetemplates", out.string
  end

  def test_should_delegate_plans_to_general
    SolusVM::General.expects(:new).with(solusvm_params).returns(mock do
      expects(:successful?).returns(true)
      expects(:plans).with("type").returns("theplans")
    end)

    out = capture_stdout do
      SolusVM::CLI.start(cli_expand_base_arguments(["general", "plans", "type"]))
    end
    assert_match "theplans", out.string
  end

  def test_should_delegate_isos_to_general
    SolusVM::General.expects(:new).with(solusvm_params).returns(mock do
      expects(:successful?).returns(true)
      expects(:isos).with("type").returns("theisos")
    end)

    out = capture_stdout do
      SolusVM::CLI.start(cli_expand_base_arguments(["general", "isos", "type"]))
    end
    assert_match "theisos", out.string
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solusvm-2.0.1.beta6 test/cli/test_general_cli.rb
solusvm-2.0.0.beta6 test/cli/test_general_cli.rb
solusvm-2.0.0.beta5 test/cli/test_general_cli.rb
solusvm-2.0.0.beta4 test/cli/test_general_cli.rb