Sha256: 0a399f3c4a91db3d0735c8f28f6e0d9d1a1cf0c7c461cfb2f1321b50228202d2

Contents?: true

Size: 1.93 KB

Versions: 10

Compression:

Stored size: 1.93 KB

Contents

require 'spec_helper'

#require 'version_info/test_file'

describe "VersionInfo defaults" do

  before :each do
    @test_module = Module.new
    @test_module.send :include, VersionInfo

    @test_module::VERSION.file_name = nil
  end

  it "is initalized" do
    @test_module::VERSION.to_hash.should == {:major => 0, :minor => 0, :patch => 0 }
  end

  it "can assign filename" do
    @test_module::VERSION.file_name = 'test_file.vinfo'
    @test_module::VERSION.file_name.should == 'test_file.vinfo'
  end

  it "has a minor property" do
    lambda {@test_module::VERSION.minor}.should_not raise_error
  end

  it "has a tag property" do
    lambda {@test_module::VERSION.tag}.should_not raise_error
  end

  it "tag has format" do
    @test_module::VERSION.tag.should == '0.0.0'    
  end

  it "tag format can be changed" do
    @test_module::VERSION.build_flag = 'pre'
    @test_module::VERSION.tag_format = @test_module::VERSION.tag_format + "--%<build_flag>s"
    @test_module::VERSION.tag.should == '0.0.0--pre'    
  end

  it "can bump a segment" do
    @test_module::VERSION.bump(:patch)
    @test_module::VERSION.tag.should == '0.0.1'    
  end

  it "bump a segment reset sublevels " do
    @test_module::VERSION.bump(:patch)
    @test_module::VERSION.bump(:minor)
    @test_module::VERSION.tag.should == '0.1.0'   
  end

end

describe "VersionInfo custom segments" do
  before :each do
    VersionInfo.segments = [:a, :b, :c]
    @test_module = Module.new
      @test_module.send :include, VersionInfo
  end

  after :each do
    VersionInfo.segments = nil # reset defaults
  end    

  it "can be assigned" do
    @test_module::VERSION.to_hash.should == {:a => 0, :b => 0, :c => 0 }
   end

  it "segments are properties" do
    lambda{@test_module::VERSION.a}.should_not raise_error
   end

  it "can bump a custom segment" do
    @test_module::VERSION.bump(:c)
    @test_module::VERSION.bump(:b)
    @test_module::VERSION.tag.should == '0.1.0'    
  end
end


Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
version_info-1.8.2 spec/version_info/version_info_spec.rb
version_info-1.8.0 spec/version_info/version_info_spec.rb
version_info-1.7.7 spec/version_info/version_info_spec.rb
version_info-1.7.6 spec/version_info/version_info_spec.rb
version_info-1.7.5 spec/version_info/version_info_spec.rb
version_info-1.7.4 spec/version_info/version_info_spec.rb
version_info-1.7.3 spec/version_info/version_info_spec.rb
version_info-1.7.2 spec/version_info/version_info_spec.rb
version_info-1.7.1 spec/version_info/version_info_spec.rb
version_info-1.7.0 spec/version_info/version_info_spec.rb