Test both only filter being a string or a regex

This commit is contained in:
hartator 2015-11-19 15:28:50 -06:00
parent 205e0da48b
commit eea0ec4b2b

View File

@ -29,14 +29,19 @@ class WaybackMachineDownloaderTest < Minitest::Test
assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-1] assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-1]
end end
def test_file_list_notthere_regex def test_file_list_only_filter_without_matches
regextester = WaybackMachineDownloader.new base_url: 'http://www.onlyfreegames.net', accept_regex: 'abc123' @wayback_machine_downloader.only_filter = 'abc123'
assert_equal 0, regextester.get_file_list_curated.length assert_equal 0, @wayback_machine_downloader.get_file_list_curated.size
end end
def test_file_list_singleresult_regex def test_file_list_only_filter_with_1_match
regextester = WaybackMachineDownloader.new base_url: 'http://www.onlyfreegames.net', accept_regex: 'menu.html$' @wayback_machine_downloader.only_filter = 'menu.html'
assert_equal 1, regextester.get_file_list_curated.length assert_equal 1, @wayback_machine_downloader.get_file_list_curated.size
end
def test_file_list_only_filter_with_a_regex
@wayback_machine_downloader.only_filter = '/\.(gif|je?pg|bmp)$/i'
assert_equal 37, @wayback_machine_downloader.get_file_list_curated.size
end end
def test_file_download def test_file_download