Sha256: 3c1a6c647d54b5684ba07292ceeaed6d141c48235290a4239328b780b5679a3f

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require File.expand_path('spec_helper', __dir__)

describe JenkinsPipelineBuilder::JobCollection do
  before :all do
    JenkinsPipelineBuilder.credentials = {
      server_ip: '127.0.0.1',
      server_port: 8080,
      username: 'username',
      password: 'password',
      log_location: '/dev/null'
    }
  end

  after :each do
    JenkinsPipelineBuilder.registry.clear_versions
  end

  before :each do
    JenkinsPipelineBuilder.debug!
  end

  context '#load_from_path' do
    before :all do
      path = File.expand_path('fixtures/job_collection', __dir__)
      described_class.new.load_from_path path
    end

    after :all do
      JenkinsPipelineBuilder.registry.registry[:job][:publishers].delete(:my_test_thing)
    end

    it 'loads extensions' do
      expect(JenkinsPipelineBuilder.registry.registry[:job][:publishers]).to have_key :my_test_thing
    end

    it 'loads extension helpers' do
      extension = JenkinsPipelineBuilder.registry.registry[:job][:publishers][:my_test_thing].extension
      builder = Nokogiri::XML::Builder.new { |xml| xml.publishers }
      xml = builder.doc
      expect(extension.execute({}, xml)).to be true
      node = xml.css('thing').first
      expect(node.name).to eq 'thing'
      expect(node.content).to eq 'cool_stuff_method'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jenkins_pipeline_builder-1.10.0 spec/lib/jenkins_pipeline_builder/job_collection_spec.rb
jenkins_pipeline_builder-1.9.1 spec/lib/jenkins_pipeline_builder/job_collection_spec.rb
jenkins_pipeline_builder-1.9.0 spec/lib/jenkins_pipeline_builder/job_collection_spec.rb
jenkins_pipeline_builder-1.8.0 spec/lib/jenkins_pipeline_builder/job_collection_spec.rb