Bart Zonneveld wrote:
> On 16-apr-2008, at 13:57, Andy Croll wrote:
>> Is there a way to specify which layout an action should use in a
>> controller?
>
> Off the top of my head, not tested:
>
> describe MyController do
> it "should use the foo layout" do
> MyController.should_receive(:layout).with("foo")
> load("app/controllers/my_controller")
> end
> end
>
> but I'm sure there's a more BDD way to do it (TIMTOWTDI goes BDDWTDI ?).
>
> greetz,
> bartz
Tried it. No dice it seems
So I then tried:
it "should use the admin layout" do
controller.should_receive(:layout).with("admin")
end
And I get...
1)
Spec::Mocks::MockExpectationError in 'Admin::ProductsController should
use the admin layout'
Mock 'Admin::ProductsController' expected :layout with ("admin") once,
but received it 0 times
I'm not doing the load ... command you suggested. What is the thinking
behind that? I'm finding that testing using RSpec demands you understand
a lot more of what is going on inside the framework!
Cheers
Andy
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users