class ImageFinderTest

Public Instance Methods

setup() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 9
def setup
end
test_find_path_pattern1() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 12
def test_find_path_pattern1
  dir = Dir.mktmpdir
  begin
    path = dir+"/builder/ch01/foo.jpg"
    FileUtils.mkdir_p(File.dirname(path))
    FileUtils.touch(path)

    finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
    assert_equal(path, finder.find_path("foo"))
  ensure
    FileUtils.remove_entry_secure dir
  end
end
test_find_path_pattern2() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 26
def test_find_path_pattern2
  dir = Dir.mktmpdir
  begin
    path = dir+"/builder/ch01-foo.jpg"
    FileUtils.mkdir_p(File.dirname(path))
    FileUtils.touch(path)

    finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
    assert_equal(path, finder.find_path("foo"))
  ensure
    FileUtils.remove_entry_secure dir
  end
end
test_find_path_pattern3() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 40
def test_find_path_pattern3
  dir = Dir.mktmpdir
  begin
    path = dir+"/builder/foo.jpg"
    FileUtils.mkdir_p(File.dirname(path))
    FileUtils.touch(path)

    finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
    assert_equal(path, finder.find_path("foo"))
  ensure
    FileUtils.remove_entry_secure dir
  end
end
test_find_path_pattern4() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 54
def test_find_path_pattern4
  dir = Dir.mktmpdir
  begin
    path = dir+"/ch01/foo.jpg"
    FileUtils.mkdir_p(File.dirname(path))
    FileUtils.touch(path)

    finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
    assert_equal(path, finder.find_path("foo"))
  ensure
    FileUtils.remove_entry_secure dir
  end
end
test_find_path_pattern5() click to toggle source
# File ../../../../../test/test_image_finder.rb, line 68
def test_find_path_pattern5
  dir = Dir.mktmpdir
  begin
    path = dir+"/ch01-foo.jpg"
    FileUtils.mkdir_p(File.dirname(path))
    FileUtils.touch(path)

    finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
    assert_equal(path, finder.find_path("foo"))
  ensure
    FileUtils.remove_entry_secure dir
  end
end