Sha256: caafc0935e7183e900f40d00bcd3b948a3ba8400afca9b807df89d8e9782231f

Contents?: true

Size: 1.02 KB

Versions: 46

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"
require "hiera/version"
require 'pathname'

describe "Hiera.version Public API" do
  subject() { Hiera }

  before :each do
    Hiera.instance_eval do
      if @hiera_version
        @hiera_version = nil
      end
    end
  end

  context "without a VERSION file" do
    before :each do
      subject.stubs(:read_version_file).returns(nil)
    end

    it "is Hiera::VERSION" do
      expect(subject.version).to eq(Hiera::VERSION)
    end
    it "respects the version= setter" do
      subject.version = '1.2.3'
      expect(subject.version).to eq('1.2.3')
    end
  end

  context "with a VERSION file" do
    it "is the content of the file" do
      subject.expects(:read_version_file).with() do |path|
        pathname = Pathname.new(path)
        pathname.basename.to_s == "VERSION"
      end.returns('1.2.1-9-g9fda440')

      expect(subject.version).to eq('1.2.1-9-g9fda440')
    end
    it "respects the version= setter" do
      subject.version = '1.2.3'
      expect(subject.version).to eq('1.2.3')
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hiera-3.3.0-x86-mingw32 spec/unit/version_spec.rb
hiera-3.3.0-x64-mingw32 spec/unit/version_spec.rb
hiera-3.2.2 spec/unit/version_spec.rb
hiera-3.2.2-x86-mingw32 spec/unit/version_spec.rb
hiera-3.2.2-x64-mingw32 spec/unit/version_spec.rb
hiera-3.2.1 spec/unit/version_spec.rb
hiera-3.2.1-x86-mingw32 spec/unit/version_spec.rb
hiera-3.2.1-x64-mingw32 spec/unit/version_spec.rb
hiera-3.2.0 spec/unit/version_spec.rb
hiera-3.2.0-x86-mingw32 spec/unit/version_spec.rb
hiera-3.2.0-x64-mingw32 spec/unit/version_spec.rb
hiera-3.1.2 spec/unit/version_spec.rb
hiera-3.1.2-x86-mingw32 spec/unit/version_spec.rb
hiera-3.1.2-x64-mingw32 spec/unit/version_spec.rb
hiera-3.1.1 spec/unit/version_spec.rb
hiera-3.1.1-x86-mingw32 spec/unit/version_spec.rb
hiera-3.1.1-x64-mingw32 spec/unit/version_spec.rb
hiera-3.1.0 spec/unit/version_spec.rb
hiera-3.1.0-x86-mingw32 spec/unit/version_spec.rb
hiera-3.1.0-x64-mingw32 spec/unit/version_spec.rb