Sha256: c2fe15ef0cf41ba08a69a6affa7bb912b092d16e1cdde0948267b4fb93bd578d

Contents?: true

Size: 1.58 KB

Versions: 11

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

describe CapsuleCD::Engine do

  describe '::new' do
    describe 'without a source specified' do
      it 'should throw an error' do
        expect{CapsuleCD::Engine.new({})}.to raise_error(CapsuleCD::Error::SourceUnspecifiedError)
      end
    end
  end

  describe '::bump_version' do
    subject{
      CapsuleCD::Engine.new({:source => :github})
    }
    it 'should default to bumping patch segement' do
      version = SemVer.parse('1.0.2')
      new_version = subject.send(:bump_version, version)
      expect(new_version.to_s).to eql('1.0.3')
    end

    describe 'when engine_version_bump_type is :minor' do
      subject{
        CapsuleCD::Engine.new({
                                  :source => :github,
                                  :engine_version_bump_type => :minor
                              })
      }
      it 'should correctly bump minor and clear patch segement' do
        version = SemVer.parse('1.0.2')
        new_version = subject.send(:bump_version, version)
        expect(new_version.to_s).to eql('1.1.0')
      end
    end

    describe 'when engine_version_bump_type is :major' do
      subject{
        CapsuleCD::Engine.new({
                                  :source => :github,
                                  :engine_version_bump_type => :major
                              })
      }
      it 'should correctly bump major and clear minor and patch segements' do
        version = SemVer.parse('1.0.2')
        new_version = subject.send(:bump_version, version)
        expect(new_version.to_s).to eql('2.0.0')
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
capsulecd-1.0.11 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.10 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.9 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.8 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.7 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.6 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.5 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.4 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.3 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.1 spec/lib/capsulecd/base/engine_spec.rb
capsulecd-1.0.0 spec/lib/capsulecd/base/engine_spec.rb