Sha256: 5f566632c16fbbe0aac788c01f2ebdda869c9118a1d356b03070df44f40fd2cf

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

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

require 'hammer_cli_foreman/mail_notification'

describe HammerCLIForeman::MailNotification do
  include CommandTestHelper

  context 'ListCommand' do
    before :each do
      ResourceMocks.mail_notifications
    end

    let(:cmd) { HammerCLIForeman::MailNotification::ListCommand.new('', ctx) }

    context 'parameters' do
      it_should_accept 'no arguments'
      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 'Id'
      it_should_print_column 'Name'
    end
  end

  context 'InfoCommand' do
    let(:cmd) { HammerCLIForeman::MailNotification::InfoCommand.new('', ctx) }

    context 'parameters' do
      it_should_accept 'id', ['--id=1']
      it_should_accept 'name', ['--name=test']
      it_should_accept 'organization', %w[--id=1 --organization-id=1]
      it_should_accept 'location', %w[--id=1 --location-id=1]
    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 'Description'
        it_should_print_column 'Subscription type'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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