Sha256: a503d7b21ec136df683b109f2e6d1670e3327a526876e396098910ec1480f6e9
Contents?: true
Size: 1.79 KB
Versions: 14
Compression:
Stored size: 1.79 KB
Contents
require "test_helper" require "roger/testing/mock_release" module Roger # Test for Roger DirFinalizer class DirFinalizerTest < ::Test::Unit::TestCase def setup @release = Testing::MockRelease.new # Create a file to release in the build dir @release.project.construct.file "build/index.html" # Set fixed version @release.scm.version = "1.0.0" end def teardown @release.destroy @release = nil end def test_basic_functionality finalizer = Roger::Release::Finalizers::Dir.new finalizer.call(@release) assert File.exist?(@release.target_path + "html-1.0.0"), @release.target_path.inspect assert File.directory?(@release.target_path + "html-1.0.0"), @release.target_path.inspect end def test_cleanup_existing_dir dir = @release.project.construct.directory("releases/html-1.0.0") finalizer = Roger::Release::Finalizers::Dir.new original_ctime = File.ctime(dir) finalizer.call(@release) assert_not_same original_ctime, File.ctime(dir) end def test_target_path finalizer = Roger::Release::Finalizers::Dir.new dir = @release.project.construct.directory("rel") finalizer.call(@release, target_path: dir) assert File.exist?(dir + "html-1.0.0") end def test_target_path_with_string finalizer = Roger::Release::Finalizers::Dir.new dir = @release.project.construct.directory("rel") finalizer.call(@release, target_path: dir.to_s) assert File.exist?(dir + "html-1.0.0") end def test_target_path_will_be_created_if_nonexistent finalizer = Roger::Release::Finalizers::Dir.new dir = @release.target_path + "rel" finalizer.call(@release, target_path: dir) assert File.exist?(dir + "html-1.0.0") end end end
Version data entries
14 entries across 14 versions & 1 rubygems