Sha256: da7545236ab6ca79134c56a0fe1eb70aeb5832e3cba54d915e5ce05b910a770d

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

require 'rubygems'
require 'rscm/changes_fixture'
require 'rscm/tempdir'
require 'damagecontrol/visitor/yaml_persister'

module DamageControl
  module Visitor
    class YamlPersisterTest < Test::Unit::TestCase
      include RSCM::ChangesFixture

      def test_should_write_several_changesets_on_save_and_reload_them
        setup_changes
        changesets = RSCM::ChangeSets.new
        changesets.add(@change1)
        changesets.add(@change2)
        changesets.add(@change3)
        changesets.add(@change4)
        changesets.add(@change5)
        changesets.add(@change6)
        changesets.add(@change7)

        changesets_dir = RSCM.new_temp_dir("changesets")
        yp = YamlPersister.new(changesets_dir)

        changesets.accept(yp)

        latest_identifier = yp.latest_identifier
        assert_equal(Time.utc(2004,7,5,12,0,14), latest_identifier)
        all_reloaded = yp.load_upto(latest_identifier, 100)
        assert_equal(changesets, all_reloaded)

        some_reloaded = yp.load_upto(Time.utc(2004,7,5,12,0,14), 2)
        assert_equal(2, some_reloaded.length)
        assert_equal(@change4, some_reloaded[0][0])
        assert_equal(@change6, some_reloaded[1][1])
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
damagecontrol-0.5.0.1391 test/damagecontrol/visitor/yaml_persister_test.rb
damagecontrol-0.5.0.1392 test/damagecontrol/visitor/yaml_persister_test.rb
damagecontrol-0.5.0.1393 test/damagecontrol/visitor/yaml_persister_test.rb
damagecontrol-0.5.0 test/damagecontrol/visitor/yaml_persister_test.rb
damagecontrol-0.5.0.1404 test/damagecontrol/visitor/yaml_persister_test.rb