Sha256: 5ad4472502ae27568b9184d27c4d1ca1f812b4c0dfc82f3720d441521d0805cc

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')

require 'test/unit'

require 'buildmaster/build_number_file'

module BuildMaster
class BuildNumberFileTest < Test::Unit::TestCase
  def test_load_file
    path = tmp_file(2)
    build_number = BuildNumberFile.new(path)
    assert_equal(2, build_number.number)
  end
  
  def test_increase_build
    path = tmp_file(3)
    build_number = BuildNumberFile.new(path)
    build_number.increase_build
    assert_equal(4, build_number.number)
    reloaded = BuildNumberFile.new(path)
    assert_equal(4, reloaded.number)
  end
  
  private
  def tmp_file(build_number)
    path = File.join(File.dirname(__FILE__), '..', '..', 'tmp', 'buildnumber')
    File.open(path, "w") {|file| file.puts build_number}
    return path
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/tc_build_number_file.rb
BuildMaster-0.8.1 test/buildmaster/tc_build_number_file.rb