<commit_before>require 'spec_helper'

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

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

    context 'result 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

  end
end<commit_msg>More tests for client<commit_after>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
        let(:result) { 'A result' }
        it do
          expect do
            Rundeck::Client.new.objectify('string')
          end.to raise_error Rundeck::Error::Parsing,
                             "Couldn't parse a response body"
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12032085561497326, 'fraction_numerical': 0.0106951871657754, 'mean_word_length': 2.311946902654867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2238705', 'n_tokens_mistral': 523, 'n_tokens_neox': 487, 'n_words': 140}