Created
September 11, 2009 20:11
-
-
Save ryanfitz/185533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
require 'nfl_scores' | |
require 'rubygems' | |
require 'fakeweb' | |
class NflScoresTest < Test::Unit::TestCase | |
def setup | |
FakeWeb.allow_net_connect = false | |
FakeWeb.register_uri(:get, "http://football.myfantasyleague.com/2009/export?TYPE=nflSchedule&W=1", :body => nfl_schedule_xml) | |
end | |
def test_number_of_matchups_is_2 | |
res = NflScores::Client.new.get_schedule_for_week(1) | |
assert_equal res["nflSchedule"]["week"], "1" | |
matchups = res["nflSchedule"]["matchup"] | |
assert_equal matchups.length, 2 | |
assert_equal matchups[0]["team"][0]["id"], "TEN" | |
assert_equal matchups[0]["team"][1]["id"], "PIT" | |
end | |
def nfl_schedule_xml | |
File.open("nflScheduleResponse.xml", 'r').read | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment