Sha256: 2cc3c016fb4b61b57308be7c824ac7a378ab438aa02b924dc2c3743777c2ab38

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 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
          @key = key == :endpoint ? "#{key}/api/12" : key
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rundeck-0.0.3 spec/rundeck_spec.rb
rundeck-0.0.3.pre spec/rundeck_spec.rb
rundeck-0.0.2.pre spec/rundeck_spec.rb
rundeck-0.0.1.pre spec/rundeck_spec.rb