2 # Copyright Michael Orlitzky
4 # http://michael.orlitzky.com/
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # http://www.fsf.org/licensing/licenses/gpl.html
20 require 'src/websites/efukt'
23 class EfuktTest
< Test
::Unit::TestCase
25 def test_owns_efukt_urls
26 assert(Efukt
.owns_url
?('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html'))
27 assert(Efukt
.owns_url
?('http://www.efukt.com/2304_The_Dumbest_Porno_Ever_Made.html'))
30 def test_doesnt_own_infoq_urls
31 assert(!Efukt
.owns_url
?('http://www.infoq.com/interviews/jim-weirich-discusses-rake'))
35 def test_get_video_filename_works_on_good_urls
36 ef
= Efukt
.new('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.html')
37 expected_filename
= '2308_How_To_Fuck_Like_A_King.flv'
38 actual_filename
= ef
.get_video_filename()
39 assert_equal(expected_filename
, actual_filename
)
43 def test_get_video_filename_works_on_weird_urls
44 # The regex looks for an html extension, so this should
45 # not match. Instead, it should fall back on everything
46 # between the final slash and that last period. In this
47 # case, the filename should be the same as if the extension
49 ef
= Efukt
.new('http://www.efukt.com/2308_How_To_Fuck_Like_A_King.broken')
50 expected_filename
= '2308_How_To_Fuck_Like_A_King.flv'
51 actual_filename
= ef
.get_video_filename()
52 assert_equal(expected_filename
, actual_filename
)