-
Notifications
You must be signed in to change notification settings - Fork 0
/
episode_test.rb
35 lines (25 loc) · 1005 Bytes
/
episode_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'test/unit'
require 'episode'
require 'hpricot'
require 'episode_test_helper'
class EpisodeTest < Test::Unit::TestCase
include EpisodeTestHelper
def test_parse_a_one_hour_episode
episodeData = Hpricot.parse(one_hour_episode_html)
episode = Episode.new episodeData
assert_equal "The Jam Session", episode.name
assert_equal "wzbc-2009-12-18-01-00.mp3", episode.locators.first
end
def test_ignore_extra_anchor
episodeData = Hpricot.parse(one_hour_episode_extra_anchor_html)
episode = Episode.new episodeData
assert_equal 1, episode.locators.size, "Should have ignored extra anchor"
end
def test_parse_a_two_hour_episode
episodeData = Hpricot.parse(two_hour_episode_html)
episode = Episode.new episodeData
assert_equal "Forward the Bass", episode.name
assert episode.locators.include?("wzbc-2009-12-19-00-00.mp3")
assert episode.locators.include?("wzbc-2009-12-19-06-00.mp3")
end
end