Sha256: 5386db1527a0710b252e5a3fd2ce2bde5eb53211f43b170397ff5ab2aa9190cc

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

require "./lib/roger/release.rb"
require "./lib/roger/release/cleaner.rb"
require "test/unit"

class CleanerTest < Test::Unit::TestCase

  def setup
    @base = File.dirname(__FILE__) + "/../../project"
  end

  def test_only_clean_inside_build_path_relative
  
    cleaner = Roger::Release::Cleaner.new(@base)
    inside_build_path = cleaner.send :is_inside_build_path, @base, @base + "/html/formats"

    assert(inside_build_path, "Only delete content inside build_path")
  end  

  def test_only_clean_inside_build_path_absolute
    path = Pathname.new(@base).realpath.to_s
    cleaner = Roger::Release::Cleaner.new(path)

    inside_build_path = cleaner.send :is_inside_build_path, path, @base + "/html/formats"

    assert(inside_build_path, "Only delete content inside build_path")
  end  

  
  def test_dont_clean_outside_build_path
    path = File.dirname(__FILE__)
    cleaner = Roger::Release::Cleaner.new(path)

    assert_raise RuntimeError do
      inside_build_path = cleaner.send :is_inside_build_path, path, @base + "/html/formats"
    end

  end
  
  def test_dont_fail_on_nonexistent_files
    path = "bla"
    cleaner = Roger::Release::Cleaner.new(path)

    assert !cleaner.send(:is_inside_build_path, @base + "/html/formats", path), "Failed on nonexistent directories/files"

  end  

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roger-0.12.2 test/unit/release/cleaner_test.rb
roger-0.12.1 test/unit/release/cleaner_test.rb
roger-0.12.0 test/unit/release/cleaner_test.rb
roger-0.11.0 test/unit/release/cleaner_test.rb
roger-0.10.0 test/unit/release/cleaner_test.rb