$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'spec' require 'buildmaster/build_number_file' require 'buildmaster/cotta' require 'buildmaster/cotta/in_memory_system' module BuildMaster context 'BuildNumberFileTest' do setup do @cotta = Cotta.new(InMemorySystem.new) end teardown do @cotta = nil end specify 'load_file' do path = @cotta.file('tmp/buildnumber') path.save(2) build_number = BuildNumberFile.new(path) build_number.number.should_equal 2 end specify 'increase_build' do path = @cotta.file('tmp/buildnumber') path.save(3) build_number = BuildNumberFile.new(path) build_number.increase_build build_number.number.should_equal 4 reloaded = BuildNumberFile.new(path) reloaded.number.should_equal 4 end end end