Permalink
Browse files

Make test resuse internet check results

  • Loading branch information...
1 parent 7bd4b44 commit a8d478aeeae71d9644922914d5da8adff31d0c2e @mateu committed Jan 12, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 t/basic.t
View
@@ -32,9 +32,13 @@ sub live_test {
# Test internet connection
my $source_URL = $wunder_forecast->_query_URL;
- my $head = head($source_URL);
- skip( 'Skipping live test using Internet', 3 ) if !$head;
+ my $content = get($source_URL);
+ skip( 'Skipping live test using Internet', 3 ) if !$content;
+ # If we're not skipping the test then let's use the $content to set the raw_data
+ # and thereby avoiding another request (which has been known to fail).
+ # Thus, we are guaranteed to have data if we get this far.
+ $wunder_forecast->raw_data($content);
my ( $highs, $lows ) = $wunder_forecast->temperatures;
my $chance_of_precip = $wunder_forecast->precipitation;
is( ref($highs), 'ARRAY', 'highs data structure for location: ' . $wunder_forecast->location );

0 comments on commit a8d478a

Please sign in to comment.