On Oct 21, 2008, at 7:24 am, Jarkko L. wrote:
controller to make the tests run faster.
There’s probably a lot of optimization left to do with the specs but
I find the dispatch helpers pretty cool for building more
specialized methods such as do_post.
Hi Jarkko
Thanks a lot for that. I’ve just got my first controller spec
working, that’s a big win!
How do you handle #only_provides ? The merb format handler is way
slicker than respond_to, but I can’t get a handle on how to spec its
behaviour. (Should you fake an XML request for controllers with
“only_provides :html”, or is
controller.should_receive(:only_provides).with(:html) more appropriate?)
And actually:
it “should display a new Item” do
do_get do |controller|
controller.should_receive(:display).with(@item)
end
end
is really nice syntax. Just need to work on factoring out the helper:
def do_get(&blk)
dispatch_to(Items, :new) do |controller|
controller.stub!(:render)
controller.stub!(:display)
yield controller if block_given?
end
end
from specs, but you can’t abstract one file!
In this case, RSpec mocks are simpler than not_a_mock. (More reason
to be able to switch framework at runtime?)
I hope the merb folks will keep us outside-(s)inners in mind and not
scrap the API.
I notice you’re on both list so hopefully you can give me nudges in
the right Merb direction and Merb nudges in the right BDD direction
But I also hope they will make concessions to isolated controller
fans. All the more reason for me to write up what I find, I guess.
Cheers
Ashley
–
http://www.patchspace.co.uk/