Sha256: 10c4e21072817eec8b0bff7b1aaef48b06778f6078ebc339be42ba0e4b1b8a16

Contents?: true

Size: 996 Bytes

Versions: 71

Compression:

Stored size: 996 Bytes

Contents

require File.expand_path('../spec_helper', __FILE__)

describe JenkinsPipelineBuilder::Utils do
  let(:utils) { JenkinsPipelineBuilder::Utils }
  describe '#symbolize_keys_deep!' do
    let(:string_hash) { { 'layer1' => { 'layer2' => { 'layer3' => 'value' } } } }
    let(:string_hash_symbols) { { layer1: { layer2: { layer3: 'value' } } } }
    it 'should symbolize the hash' do
      utils.symbolize_keys_deep!(string_hash)
      expect(string_hash).to eq(string_hash_symbols)
    end
  end
  describe '#hash_merge!' do
    let(:hash_with_array) { { name: 'withArray', value: { publishers: [{ downstream: true }, { other: true }] } } }
    let(:hash_with_array2) { { name: 'withArray', value: { publishers: [{ downstream: false }] } } }
    it 'deep merge two hashes' do
      utils.hash_merge!(hash_with_array, hash_with_array2)
      expect(hash_with_array[:value][:publishers].count).to eq(1)
      expect(hash_with_array[:value][:publishers][0][:downstream]).to be_falsey
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
jenkins_pipeline_builder-1.7.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.5.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.3.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.2.1 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.2.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.1.5 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.1.4 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.1.3 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.1.2 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.1.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-1.0.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.16.3 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.16.2 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.16.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.15.3 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.15.2 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.15.1 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.14.0 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.13.4 spec/lib/jenkins_pipeline_builder/utils_spec.rb
jenkins_pipeline_builder-0.13.3 spec/lib/jenkins_pipeline_builder/utils_spec.rb