Sha256: a57e0b846db752282c2472e848d84776c22cd323629b7a28884432c8a170bb1f

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

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

require 'hammer_cli_foreman/settings'

describe HammerCLIForeman::Settings do

  include CommandTestHelper

  context "ListCommand" do

    before do
      ResourceMocks.mock_action_call(:settings, :index, [])
    end

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

    context "parameters" do
      it_should_accept "no arguments"
      it_should_accept_search_params
      it_should_accept 'organization', ['--organization-id=1']
      it_should_accept 'location', ['--location-id=1']
    end

    context "output" do
      let(:expected_record_count) { count_records(cmd.resource.call(:index)) }

      it_should_print_n_records
      it_should_print_column "Name"
      it_should_print_column "Full name"
      it_should_print_column "Value"
      it_should_print_column "Description"
    end

  end

  context "UpdateCommand" do
    let(:cmd) { HammerCLIForeman::Settings::UpdateCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "name", ["--name=setting1", "--value=setting2"]
      it_should_accept "id", ["--id=1", "--value=setting2"]
      it_should_accept 'organization', %w[--id=1 --organization-id=1]
      it_should_accept 'location', %w[--id=1 --location-id=1]
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hammer_cli_foreman-3.7.0 test/unit/settings_test.rb
hammer_cli_foreman-3.5.1 test/unit/settings_test.rb
hammer_cli_foreman-3.6.0 test/unit/settings_test.rb
hammer_cli_foreman-3.5.0 test/unit/settings_test.rb
hammer_cli_foreman-3.4.0 test/unit/settings_test.rb
hammer_cli_foreman-3.3.0 test/unit/settings_test.rb
hammer_cli_foreman-3.2.0 test/unit/settings_test.rb
hammer_cli_foreman-3.1.0 test/unit/settings_test.rb
hammer_cli_foreman-3.0.0 test/unit/settings_test.rb