Sha256: ebfd264a77e28b33507961b09db23075429008120cdbc71a17417bc48b26b7db

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe Rundeck do
  after { Rundeck.reset }

  # nothing too special to check, just existence
  it { is_expected.to respond_to(:endpoint) }
  it { is_expected.to respond_to(:endpoint=) }
  it { is_expected.to respond_to(:api_token) }
  it { is_expected.to respond_to(:api_token=) }

  describe '.client' do
    subject { Rundeck.client }
    it { is_expected.to be_a Rundeck::Client }
  end

  describe '.user_agent=' do
    subject { Rundeck.user_agent }

    context 'when unspecified' do
      it { is_expected.to eq(Rundeck::Configuration::DEFAULT_USER_AGENT) }
    end

    context 'when specified' do
      before { Rundeck.user_agent = 'Custom Rundeck Ruby Gem' }
      it { is_expected.to eq('Custom Rundeck Ruby Gem') }
    end
  end

  # This seems silly, but since we're adding special logic to
  # `method_missing` we should check it still raises an error in
  # the proper case
  describe '.method_missing' do
    context 'when client does not respond' do
      it { expect { Rundeck.fake }.to raise_error NoMethodError }
    end
  end

  describe '.configure' do
    Rundeck::Configuration::VALID_OPTIONS_KEYS.each do |key|
      context "when setting #{key}" do
        subject { Rundeck.send(key) }

        before do
          Rundeck.configure do |config|
            config.send("#{key}=", key)
          end
        end

        it { is_expected.to eq(key) }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rundeck-1.2.1 spec/rundeck_spec.rb
rundeck-1.2.0 spec/rundeck_spec.rb
rundeck-1.1.0 spec/rundeck_spec.rb
rundeck-1.0.2 spec/rundeck_spec.rb
rundeck-1.0.1 spec/rundeck_spec.rb