require "test_helper" require "assert_dirs_equal/matcher" module AssertDirsEqual class MatcherTest < Minitest::Test def matcher @matcher ||= Matcher.new(expected_dir) end def test_missing_expected @case_directory = "test/cases/missing_expected" refute matcher.matches?(target_dir) assert_equal "expected \"#{expected_dir}\" to exist", matcher.failure_message end def test_missing_target @case_directory = "test/cases/missing_target" refute matcher.matches?(target_dir) assert_equal "expected \"#{target_dir}\" to exist", matcher.failure_message end def test_expected_is_not_a_dir @case_directory = "test/cases/expected_is_not_a_dir" refute matcher.matches?(target_dir) assert_equal "expected \"#{expected_dir}\" to be a directory", matcher.failure_message end def test_target_is_not_a_dir @case_directory = "test/cases/target_is_not_a_dir" refute matcher.matches?(target_dir) assert_equal "expected \"#{target_dir}\" to be a directory", matcher.failure_message end def test_missing_file_in_target @case_directory = "test/cases/missing_file_in_target" refute matcher.matches?(target_dir) assert_equal "expected \"#{target_dir}/file\" to exist since \"#{expected_dir}/file\" exists", matcher.failure_message end def test_missing_nested_file_in_target @case_directory = "test/cases/missing_nested_file_in_target" refute matcher.matches?(target_dir) assert_equal "expected \"#{target_dir}/nested/file\" to exist since \"#{expected_dir}/nested/file\" exists", matcher.failure_message end def test_empty_files_are_equal @case_directory = "test/cases/empty_files_are_equal" assert matcher.matches?(target_dir), matcher.failure_message end def test_different_text_files @case_directory = "test/cases/different_text_files" refute matcher.matches?(target_dir) assert_equal <