Hi Ashley,

   You might want to check on
http://www.slideshare.net/wycats/testing-merb-presentation  Yehuda's
presentation on testing Merb apps the Merb way.

If you generate a new 1.0RC app and then a resource you will notice that we
don't generate any controller or view specs anymore. The reason being that
we believe you should test the full request ad not just mock what the
controller does.

Here is an example of a model, controller and request spec:

http://gist.github.com/17973

It's not complete but should help you to get started.

-Matt



On Sun, Oct 19, 2008 at 1:03 PM, Ashley Moran <[EMAIL PROTECTED]
> wrote:

>
> Hi,
>
> I'm new to Merb, just starting my first app tonight.  I'd like to
> write a spec along these lines:
>
>   describe Items, "#new" do
>     before(:each) do
>       @item = mock(Item)
>       Item.stub!(:new).and_return(@item)
>     end
>     it "should display a new Item" do
>       <controller>.should_receive(:display).with(@item)
>       dispatch_to(Items, :index)
>     end
>   end
>
> to describe this:
>
>   class Items < Application
>     def new
>       @item = Item.new
>       display @item
>     end
>   end
>
> But the Merb example groups don't appear to provide access to the
> controller.  (Maybe it doesn't exist at this point anyway?)  The
> closest I can find is on the Slapp page[1], but the approach their
> involves a bit too much voodoo magic for my liking (perhaps just my
> opinion because I'm not yet brave enough to go poking around the Merb
> spec internals).
>
> Can anyone show me the best/a good way to write a spec for this?  Any
> help for a Merb n00b much appreciated.
>
> Cheers
> Ashley
>
> [1] http://www.socialface.com/slapp/
>
> --
> http://www.patchspace.co.uk/
> http://aviewfromafar.net/
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to