O'Reilly logo

Programming Phoenix by Jose Valim, Bruce Tate, Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Mix to Run Phoenix Tests

Whether you knew it or not, Phoenix has already been generating default tests for you, such as test/controllers/video_controller_test.exs. We can go ahead and remove that file since it’s built for generic REST actions, not the features we’ve specifically built into our controller. We’ve added user authentication, validations, and the like to our videos, so we’ll start fresh with our VideoController tests. Delete the test/controllers/video_controller_test.exs file now, and then let’s see where our test suite stands:

 $ ​​mix​​ ​​test
 ...
  1) test GET / (Rumbl.PageControllerTest)
  test/controllers/page_controller_test.exs:4
  Assertion with =~ failed
  code: html_response(conn, 200) =~ "Welcome to Phoenix!" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required