Sha256: 7b6487a7d90904c51c1599e61776816c14bd3a6272c1f197a22cb9275170e242

Contents?: true

Size: 1.86 KB

Versions: 39

Compression:

Stored size: 1.86 KB

Contents

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

require 'hammer_cli_foreman/config_group'

describe HammerCLIForeman::ConfigGroup do
  include CommandTestHelper

  context "ListCommand" do
    let(:cmd) { HammerCLIForeman::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) { HammerCLIForeman::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) { HammerCLIForeman::ConfigGroup::CreateCommand.new("", ctx) }

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

  context "DeleteCommand" do
    let(:cmd) { HammerCLIForeman::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) { HammerCLIForeman::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

39 entries across 39 versions & 1 rubygems

Version Path
hammer_cli_foreman-2.3.2 test/unit/config_group_test.rb
hammer_cli_foreman-2.3.1 test/unit/config_group_test.rb
hammer_cli_foreman-2.3.0 test/unit/config_group_test.rb
hammer_cli_foreman-2.1.3 test/unit/config_group_test.rb
hammer_cli_foreman-2.2.0 test/unit/config_group_test.rb
hammer_cli_foreman-2.1.2 test/unit/config_group_test.rb
hammer_cli_foreman-2.1.1 test/unit/config_group_test.rb
hammer_cli_foreman-2.1.0 test/unit/config_group_test.rb
hammer_cli_foreman-2.0.2 test/unit/config_group_test.rb
hammer_cli_foreman-2.0.1 test/unit/config_group_test.rb
hammer_cli_foreman-2.0.0 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.7 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.6 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.5 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.4 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.3 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.2 test/unit/config_group_test.rb
hammer_cli_foreman-0.18.2 test/unit/config_group_test.rb
hammer_cli_foreman-0.19.1 test/unit/config_group_test.rb
hammer_cli_foreman-0.18.1 test/unit/config_group_test.rb