Sha256: b78107b3e72be55465cd994fa40cf40997c485cdc8f89d9ea207278e01d99516

Contents?: true

Size: 1020 Bytes

Versions: 85

Compression:

Stored size: 1020 Bytes

Contents

require "spec_helper"
require "puppet/version"
require 'pathname'

describe "Puppet.version Public API" do
  before :each do
    Puppet.instance_eval do
      if @puppet_version
        @puppet_version = nil
      end
    end
  end

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

    it "is Puppet::PUPPETVERSION" do
      Puppet.version.should == Puppet::PUPPETVERSION
    end
    it "respects the version= setter" do
      Puppet.version = '1.2.3'
      Puppet.version.should == '1.2.3'
    end
  end

  context "with a VERSION file" do
    it "is the content of the file" do
      Puppet.expects(:read_version_file).with() do |path|
        pathname = Pathname.new(path)
        pathname.basename.to_s == "VERSION"
      end.returns('3.0.1-260-g9ca4e54')

      Puppet.version.should == '3.0.1-260-g9ca4e54'
    end
    it "respects the version= setter" do
      Puppet.version = '1.2.3'
      Puppet.version.should == '1.2.3'
    end
  end
end

Version data entries

85 entries across 85 versions & 2 rubygems

Version Path
puppet-3.1.1 spec/unit/version_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/spec/unit/version_spec.rb
puppet-3.1.0 spec/unit/version_spec.rb
puppet-3.1.0.rc2 spec/unit/version_spec.rb
puppet-3.1.0.rc1 spec/unit/version_spec.rb