Test If An Instance Variable Was Assigned
When testing Rails controller actions, you'll often be making assertions about the response to your test request. You may also want to assert about the instance variables being set, as those are headed for your view layer.
For instance, if an instance variable @metadata
is supposed to be set in a #show
controller action, you can assert that it is with RSpec's assigns
:
Last updated