Sha256: 2a789604417a1b39efa3e9a1f872eb63c2b322add297c09792bd06ef563194ad

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe JenkinsTracker::Base do

  describe '#initialize' do
    it 'does basic set up' do
      obj = described_class.new(
        :changelog_file => fixture_file_path('git_changelog.txt'),
        :tracker_token => 'xxx',
        :job_name => 'foo_job',
        :build_url => 'http://jenkins.bitium/com/foo_job/3'
      )
      expect(obj.changelog).to eq( File.read(fixture_file_path('git_changelog.txt')) )
      expect(obj.tracker_client.token).to eq('xxx')
      expect(obj.job_name).to eq('foo_job')
      expect(obj.build_url).to eq('http://jenkins.bitium/com/foo_job/3')
    end

    context 'when changelog file does not exist' do
      it 'raises a FileNotFoundError' do
        changelog_file = '/a/non-existent/file/path'

        expect {
          described_class.new(
            :changelog_file => changelog_file,
            :tracker_token => 'xxx',
            :job_name      => 'foo_job',
            :build_url     => 'http://jenkins.bitium/com/foo_job/3'
          )
        }.to raise_error(JenkinsTracker::FileNotFoundError, "Changelog file not found at: #{changelog_file}")
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jenkins_tracker-0.2.1 spec/jenkins_tracker/base_spec.rb
jenkins_tracker-0.2.0 spec/jenkins_tracker/base_spec.rb