I am running Rails 4 with Ruby 2.1.1.
I have in my Controller def home render :index end and I am writing a Unit::Test to check that the controller renders the view index with the method home.
How would I write the assertion? So far I have test "home should have index" do assert true end
My test passes, of course, because I have assert true, but upon looking over the documentation, and having tinkered around, I am still unsure how to write a proper functional test for a Controller. Many sources are incomplete or vague, and seeing how no simple Stack Overflow question regarding writing a simple functional test using Unit::Test appears on Stack Overflow, I figured this would be a great question.
All I want is a clear answer to assert that my functional test checks that the home method renders index. Once I figure out how a basic functional test is written, I think I'll be able to proceed to testing the rest of my app.
Cheers
TL;DR I don't know how to write a basic functional test. How do I do that? Please be Unit::Test beginner friendly.
Aucun commentaire:
Enregistrer un commentaire