jeudi 29 octobre 2015

writing a spec for partial used in the layout

I'm trying to test a partial included in a layout. Following is my setup.

I have a base controller which is based for several other controllers.

BaseController < ApplciationController
  layout 'base' 
end

So, in the base layout I have included a partial _my_partial. I'm not sure how exactly to test , if the layout renders the partial.

Ex: I can test it from a controller action spec which inherit by base controller.

UsersController < BaseController
  def index

  end
end 

#users controller spec #index action
get :index
response.should render_template(:partial => "_my_partial")

But this seems to me little odd, because I actually want to test if the partial in included in every controller which inherits it. I'm thinking this test doesn't implies that.

Any ideas on how write this spec which make sense , thanks in advance..

Aucun commentaire:

Enregistrer un commentaire