posted in today-i-learned
If you have ever tried to write functional tests for a controller, you will know that they can be a little tricky. One such trip up point that I ran into was accessing instance variables from within the controller spec. You can't just use
expect(@variable).to be_valid because
@variable is an instance variable and won't be defined in your spec's scope.