Sha256: cc500d03b112908edf6df0afe32a6a755d05671ce8d6aed025ed2eff3d89a060

Contents?: true

Size: 1.36 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
solusvm-2.0.0.beta2 test/cli/test_general_cli.rb
solusvm-2.0.0.beta1 test/cli/test_general_cli.rb