Sha256: da92b2cd3c274a760c4c1c5de5fc2b721ccaacfc7523087f79111fae79c5c167

Contents?: true

Size: 952 Bytes

Versions: 10

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

describe Rundeck::Client do
  describe '#objectify' do
    subject { Rundeck::Client.new.objectify(result) }

    context 'when result' do
      context 'is a hash' do
        let(:result) { { a: 1, b: 2 } }
        it { is_expected.to be_a Rundeck::ObjectifiedHash }
      end

      context 'is an array' do
        let(:result) { [{ a: 1, b: 2 }, { c: 3, d: 4 }] }

        it { is_expected.to be_a Array }
        its([0]) { is_expected.to be_a Rundeck::ObjectifiedHash }
        its([1]) { is_expected.to be_a Rundeck::ObjectifiedHash }
      end

      context 'is a string' do
        it do
          expect do
            Rundeck::Client.new.objectify('string')
          end.to raise_error Rundeck::Error::Parsing,
                             "Couldn't parse a response body"
        end
      end

      context 'is nil' do
        let(:result) { nil }
        it { is_expected.to be_nil }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rundeck-1.2.1 spec/rundeck/client_spec.rb
rundeck-1.2.0 spec/rundeck/client_spec.rb
rundeck-1.1.0 spec/rundeck/client_spec.rb
rundeck-1.0.2 spec/rundeck/client_spec.rb
rundeck-1.0.1 spec/rundeck/client_spec.rb
rundeck-0.0.4 spec/rundeck/client_spec.rb
rundeck-0.0.3 spec/rundeck/client_spec.rb
rundeck-0.0.3.pre spec/rundeck/client_spec.rb
rundeck-0.0.2.pre spec/rundeck/client_spec.rb
rundeck-0.0.1.pre spec/rundeck/client_spec.rb