Displaying 1 result from an estimated 1 matches for "mock_builder".
2007 Feb 23
4
How can I spec this? The method gets passed a block...
...The code I want to spec is
    xml.video do
      xml.id @video_id
      xml.views @views
      xml.date(@date.to_s) if @date
    end
I''d like to mock it, rather than asserting that the XML is the right
string.  I can do one spec:
  specify "should create a video tag" do
    @mock_builder.should_receive(:video)
    do_report
  end
but I can''t do anything else.  Setting an expectation for :id, :views,
and :date all fail.  It''s obvious to me why it does...the stubbed
:video method doesn''t know to execute the stuff in the block.  So
what''s the best...