On Wed, Oct 1, 2008 at 1:02 AM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> RssReader when there is an HTTP error
> - should attempt to parse the RSS
> - should not attempt to parse the RSS
> - should fail gracefully
>From what I can see, your code error is not doing anything with the
caught exception:
def rss
rss_body =
begin
@uri.read
rescue OpenURI::HTTPError => e
nil
end
::RSS::Parser.parse(rss_body, false)
end
This starts reading the body, catches an error, evaluates nil, exits
the rescue block and then continues to do the Parser.parse.
Changing it to:
def rss
rss_body =
begin
@uri.read
::RSS::Parser.parse(rss_body, false)
rescue OpenURI::HTTPError => e
nil
end
end
Should pass your specs.
Mikel
--
http://lindsaar.net/
Rails, RSpec and Life blog....
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users