Sha256: 166151dd9e5eaaf757b7585d1619758b4e6ee76aaeab904dd51da680c704fbea

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')


describe HammerCLIForeman::PuppetClass do

  extend CommandTestHelper

  before :each do
    cmd.class.resource ApipieResourceMock.new(cmd.class.resource.resource_class)
  end

  context "ListCommand" do

    let(:cmd) { HammerCLIForeman::PuppetClass::ListCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "no arguments"
      # FIXME: the command should accept search parameters in future
      # it_should_accept_search_params
    end

    context "output" do
      let(:expected_record_count) { cmd.resource.call(:index)[0].length }

      it_should_print_n_records
      it_should_print_column "Id"
      it_should_print_column "Name"
    end

  end


  context "InfoCommand" do

    let(:cmd) { HammerCLIForeman::PuppetClass::InfoCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "id", ["--id=1"]
      it_should_fail_with "no arguments"
    end

    context "output" do
      with_params ["--id=1"] do
        it_should_print_n_records 1
        it_should_print_column "Id"
        it_should_print_column "Name"
        it_should_print_column "Smart variables"
      end
    end

  end

  context "SCParamsCommand" do

    before :each do
      cmd.class.resource ResourceMocks.smart_class_parameter
    end

    let(:cmd) { HammerCLIForeman::PuppetClass::SCParamsCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "name", ["--name=env"]
      it_should_accept "id", ["--id=1"]
      it_should_fail_with "name or id missing", []
    end

  end


end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hammer_cli_foreman-0.0.17 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.16 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.15 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.14 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.13 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.12 test/unit/puppet_class_test.rb
hammer_cli_foreman-0.0.11 test/unit/puppet_class_test.rb