Sha256: f30118e29b867761b38418c9e4a998f9b9824c74d8398d57fa86dc5ef2487b4f

Contents?: true

Size: 1.92 KB

Versions: 2

Compression:

Stored size: 1.92 KB

Contents

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

require 'hammer_cli_foreman_puppet/config_group'

describe HammerCLIForemanPuppet::ConfigGroup do
  include CommandTestHelper

  context "ListCommand" do
    let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::ListCommand.new("", ctx) }

    before :each do
      ResourceMocks.config_groups_index
    end

    context "parameters" do
      it_should_accept "no arguments"
      it_should_accept_search_params
    end

    context "output" do
      let(:expected_record_count) { cmd.resource.call(:index).length }
      it_should_print_n_records
      it_should_print_columns ["ID", "Name"]
    end
  end

  context "InfoCommand" do
    let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::InfoCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "id", ["--id=1"]
      it_should_accept "name", ["--name=group_x"]
    end

    context "output" do
      with_params ["--id=1"] do
        it_should_print_n_records 1
        it_should_print_column "Name"
        it_should_print_column "ID"
        it_should_print_column "Puppetclasses"
      end
    end
  end

  context "CreateCommand" do
    let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::CreateCommand.new("", ctx) }

    context "parameters" do
      it_should_accept 'name, puppetclass ids',
                       %w[--name=first_group --puppet-class-ids=1,2]
    end
  end

  context "DeleteCommand" do
    let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::DeleteCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "name", ["--name=group_x"]
      it_should_accept "id", ["--id=1"]
    end
  end

  context "UpdateCommand" do

    let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::UpdateCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "name", ["--name=group_x"]
      it_should_accept "id", ["--id=1"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hammer_cli_foreman_puppet-0.0.7 test/unit/config_group_test.rb
hammer_cli_foreman_puppet-0.0.6 test/unit/config_group_test.rb