On 1 Oct 2008, at 14:11, Mikel Lindsaar wrote:

Changing it to:

   def rss
     rss_body =
       begin
         @uri.read
         ::RSS::Parser.parse(rss_body, false)
       rescue OpenURI::HTTPError => e
         nil
       end
   end

Ah don't worry, that's what my real code does. The code I posted was mid-refactoring.


Should pass your specs.


It's academic really, but this code:
   def rss
     rss_body =
       begin
         @uri.read
       rescue OpenURI::HTTPError => e
         nil
       end

     ::RSS::Parser.parse(rss_body, false)
   end


*does* pass the specs, both the one that says parse should be called, and the one that say it shouldn't! But why? I'm prepared to admit I'm just missing something really really really obvious (it happens often), but how can:

    it "should attempt to parse the RSS" do
      ::RSS::Parser.should_receive(:parse)
      @rss_reader.rss
    end

    it "should not attempt to parse the RSS" do
      ::RSS::Parser.should_not_receive(:parse)
      @rss_reader.rss
    end

both pass, under any circumstances?

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to