Permalink
Browse files

Added the Cider Weather (sunny day) Scenario to the Weather display f…

…eature
  • Loading branch information...
1 parent ad1ae67 commit 267a060904773b4768bc3869b55ecacc6adeef68 @anibal committed May 15, 2011
Showing with 82 additions and 6 deletions.
  1. +72 −0 features/cassettes/weather_sunny.yml
  2. +3 −6 features/step_definitions/weather_steps.rb
  3. +7 −0 features/weather.feature
@@ -0,0 +1,72 @@
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
+ method: :get
+ uri: http://weather.yahooapis.com:80/forecastrss?p=ASXX0075&u=c
+ body:
+ headers:
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
+ code: 200
+ message: OK
+ headers:
+ expires:
+ - Sun, 15 May 2011 02:16:17 GMT
+ content-type:
+ - text/xml;charset=UTF-8
+ date:
+ - Sun, 15 May 2011 01:56:17 GMT
+ cache-control:
+ - private, max-age=1200
+ transfer-encoding:
+ - chunked
+ body: |
+ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+ <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
+ <channel>
+
+ <title>Yahoo! Weather - Melbourne, AS</title>
+ <link>http://us.rd.yahoo.com/dailynews/rss/weather/Melbourne__AS/*http://weather.yahoo.com/forecast/ASXX0075_c.html</link>
+ <description>Yahoo! Weather for Melbourne, AS</description>
+ <language>en-us</language>
+ <lastBuildDate>Sun, 15 May 2011 11:00 am AEST</lastBuildDate>
+ <ttl>60</ttl>
+ <yweather:location city="Melbourne" region="" country="AS"/>
+ <yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/>
+ <yweather:wind chill="13" direction="250" speed="25.75" />
+ <yweather:atmosphere humidity="58" visibility="9.99" pressure="1015.92" rising="0" />
+ <yweather:astronomy sunrise="7:12 am" sunset="5:20 pm"/>
+ <image>
+ <title>Yahoo! Weather</title>
+ <width>142</width>
+ <height>18</height>
+ <link>http://weather.yahoo.com</link>
+ <url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url>
+ </image>
+ <item>
+ <title>Conditions for Melbourne, AS at 11:00 am AEST</title>
+ <geo:lat>-37.74</geo:lat>
+ <geo:long>144.9</geo:long>
+ <link>http://us.rd.yahoo.com/dailynews/rss/weather/Melbourne__AS/*http://weather.yahoo.com/forecast/ASXX0075_c.html</link>
+ <pubDate>Sun, 15 May 2011 11:00 am AEST</pubDate>
+ <yweather:condition text="Sunny" code="32" temp="13" date="Sun, 15 May 2011 11:00 am AEST" />
+ <description><![CDATA[
+ <img src="http://l.yimg.com/a/i/us/we/52/32.gif"/><br />
+ <b>Current Conditions:</b><br />
+ Sunny, 13 C<BR />
+ <BR /><b>Forecast:</b><BR />
+ Sun - Sunny. High: 16 Low: 8<br />
+ Mon - Sunny. High: 16 Low: 6<br />
+ <br />
+ <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Melbourne__AS/*http://weather.yahoo.com/forecast/ASXX0075_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/>
+ (provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/>
+ ]]></description>
+ <yweather:forecast day="Sun" date="15 May 2011" low="8" high="16" text="Sunny" code="32" />
+ <yweather:forecast day="Mon" date="16 May 2011" low="6" high="16" text="Sunny" code="32" />
+ <guid isPermaLink="false">ASXX0075_2011_05_15_11_00_AEST</guid>
+ </item>
+ </channel>
+ </rss>
+ <!-- api7.weather.ac4.yahoo.com uncompressed/chunked Sat May 14 18:56:17 PDT 2011 -->
+
+ http_version: "1.1"
@@ -1,4 +1,4 @@
-Given /^the day is "(.+)"$/ do |description|
+Given /^the day is "([^"]*)"$/ do |description|
@cassete = "weather_#{description}"
end
@@ -12,14 +12,11 @@
# TODO: This should test for low and high in an explicit way, current
# HTML structure doesn't really allow it, so it will wait a new layout
# with ID's for weather, max and min
- puts "*"*80
- require 'pp'
- pp page.methods - Object.methods
- pp body
Then "I should see \"#{temperature}\" within \".temp\""
end
Then /^I should see the icon of a "(.+)"$/ do |icon|
- icon_sources = { 'clouded sun' => 'http://l.yimg.com/a/i/us/we/52/28.gif' }
+ icon_sources = { 'clouded sun' => 'http://l.yimg.com/a/i/us/we/52/28.gif',
+ 'bright spotless sun' => 'http://l.yimg.com/a/i/us/we/52/32.gif' }
Then "I should see the image \"#{icon_sources[icon]}\""
end
@@ -10,3 +10,10 @@ Feature: Weather display
And I should see "16°" degrees as "maximum" temperature
And I should see the icon of a "clouded sun"
+ Scenario:
+ Given the day is "sunny"
+ And I visit the home page
+ Then I should see "Cider Weather"
+ And I should see "13°" degrees as "minimum" temperature
+ And I should see "16°" degrees as "maximum" temperature
+ And I should see the icon of a "bright spotless sun"

0 comments on commit 267a060

Please sign in to comment.