Sha256: 6a2ab5829f7ec034f7911108a5623736d333cab7ecd21f3f6571e219a242de10

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe VersionCake::VersionContext do
  let(:resource) do
    double(
        latest_version: 8,
        supported_versions: [5,6,7,8],
        deprecated_versions: [4],
        obsolete_versions: [2,3]
    )
  end
  let(:result) { :supported }
  subject(:context) { described_class.new(version, resource, result) }

  describe '#supported_versions' do
    let(:version) { 7 }

    it { expect(context.supported_versions).to eq [7,6,5] }

    context 'for a deprecated version' do
      let(:version) { 4 }
      let(:result) { :deprecated }

      it { expect(context.supported_versions).to eq [] }
    end

    context 'for an obsolete version' do
      let(:version) { 2 }
      let(:result) { :obsolete }

      it { expect(context.supported_versions).to eq [] }
    end
  end

  describe '#is_latest_version?' do
    let(:version) { 8 }

    it { expect(context.is_latest_version?).to be true }

    context 'when it is less than the latest' do
      let(:version) { 7 }

      it { expect(context.is_latest_version?).to be false }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
versioncake-3.1.0 spec/unit/version_context_spec.rb
versioncake-3.0.0 spec/unit/version_context_spec.rb