Testing partials

Guys,

How can we test partials and layouts.. ? Googled but find nothing
useful..

In the same way you test your views. You can use Selenium if you like.
I don't like the use of Selenium for this, I prefer to test the views
contain the text that should be there and delegate the full testing of
the view to a human tester. (Probably myself, but can be other people
if you have a test team)

Hope it helps.

Hi Leonardo,

I am not using any tool for tesing. Neither i want to..

Leonardo Mateo wrote:

So, you're asking how to test your views, and you don't want to use
any tool for testing?
I assume you have your reasons for not doing any testing, but if you
don't want to use any tool, you'll have to test them by hand.

If you are using functional tests, then just use assert_select to verify that the HTML that the partial generates is somewhere in the response. For example, if you have a partial that prints out “

hello
”, test a controller that has a view that calls that partial, and then do

assert_select “div”, “hello”

then you’ll know the partial worked.