Sha256: c7d13eb9adabfab44a76399f825a0c5d3f65c63d23f02cb65540ad9f7690e270

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 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)

    $stdout.expects(:puts).with("thetemplates")
    Solusvm::Cli.start(cli_expand_base_arguments(["general", "templates", "type"]))
  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)

    $stdout.expects(:puts).with("theplans")
    Solusvm::Cli.start(cli_expand_base_arguments(["general", "plans", "type"]))
  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)

    $stdout.expects(:puts).with("theisos")
    Solusvm::Cli.start(cli_expand_base_arguments(["general", "isos", "type"]))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solusvm-1.4.0 test/cli/test_general_cli.rb
solusvm-1.3.1 test/cli/test_general_cli.rb
solusvm-1.3.0 test/cli/test_general_cli.rb