Sha256: ec2713411c4af72f398c2522e550bcda5c331ffffb5f479bb9bee7119b18c3cd

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe VersionCake::VersionChecker do
  let(:resource) do
    double(
      supported_versions: [5,6],
      deprecated_versions: [4],
      obsolete_versions: [2,3],
    )
  end
  let(:version) { }
  subject do
    checker = VersionCake::VersionChecker.new(version, resource)
    checker.execute
  end

  describe '#execute' do
    context 'when no version is passed in' do
      let(:version) { nil }

      it { is_expected.to eq :no_version }
    end

    context 'when the version is a supported version' do
      let(:version) { 5 }

      it { is_expected.to eq :supported }
    end

    context 'when the version is an obsolete version' do
      let(:version) { 3 }

      it { is_expected.to eq :obsolete }
    end

    context 'when the version is a deprecated version' do
      let(:version) { 4 }

      it { is_expected.to eq :deprecated }
    end

    context 'when the version is greater than the supported versions' do
      let(:version) { 7 }

      it { is_expected.to eq :version_too_high }
    end

    context 'when the version is less than the supported versions' do
      let(:version) { 1 }

      it { is_expected.to eq :version_too_low }
    end

    context 'when the version is of a strange format' do
      let(:version) { '1' }

      it { is_expected.to eq :invalid_format }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
versioncake-4.1.1 spec/unit/version_checker_spec.rb
versioncake-4.1.0 spec/unit/version_checker_spec.rb