1 # Unit tests for the Redtube class. Basically just checking
2 # the results of get_video_url for known ids.
5 require 'src/websites/redtube'
7 class RedtubeTest
< Test
::Unit::TestCase
9 def test_owns_redtube_urls
10 assert(Redtube
.owns_url
?('http://www.redtube.com/6807'))
11 assert(Redtube
.owns_url
?('www.redtube.com/6807'))
12 assert(Redtube
.owns_url
?('http://redtube.com/6807'))
13 assert(Redtube
.owns_url
?('redtube.com/6807'))
17 def test_doesnt_own_howcast_urls
18 assert(!Redtube
.owns_url
?('http://www.howcast.com/6807'))
19 assert(!Redtube
.owns_url
?('www.howcast.com/6807'))
20 assert(!Redtube
.owns_url
?('http://howcast.com/6807'))
21 assert(!Redtube
.owns_url
?('howcast.com/6807'))
25 def test_doesnt_own_misc_urls
26 assert(!Redtube
.owns_url
?('http://redtube/123'))
27 assert(!Redtube
.owns_url
?('www.redtube.com/abc'))
31 def test_get_video_url
34 test_result
= rt
.get_video_url('http://www.redtube.com/6807')
35 assert_equal("http://dl.redtube.com/_videos_t4vn23s9jc5498tgj49icfj4678/0000006/X57OBH08G.flv", test_result
)