I have a Sinatra app that serves pages as read-only or editable depending on if the user is logged in.
The controller sets a variable @can_edit
, that is used by the views to hide/show edit links. How can I test @can_edit
's value in my tests? I have no idea how to get at the current instance of the controller under Rack::Test.
I use class_eval
to stub the logged_in?
method in the controller, but I'm having to resort to checking last_response.body
for my edit links to see if @can_edit
has been set or not.
How can I test the value of @can_edit
directly?