...

/

Functional Testing of Controllers

Functional Testing of Controllers

Learn to do functional testing of controllers.

We'll cover the following...

Now for the moment of truth. Before we focus on writing new tests, we need to determine if we’ve broken anything. Remember our experience after we added validation logic to our model! With that in mind, let’s run our tests again:

depot> bin/rails test

Note: We have provided a live terminal at the end of this lesson. You can run the commands of this lesson in the provided terminal.

This time, all is well. We added a lot, but we didn’t break anything. That’s a relief! Our work isn’t done yet, though. We still need tests for what we just added.

The unit testing of models that we did previously seemed straightforward. We called a method and compared what it returned against what we expected it to return. However, we are now dealing with a server that processes requests and a ...