I have the following step for a Cucumber scenario:
Given /^I am not logged in$/ do
request.reset_session
controller.instance_variable_set(:@_current_user, nil)
end
But when I run my Cucumber features, I get:
undefined method `reset_session' for nil:NilClass (NoMethodError)
My setup:
- rails 3.0.3
- cucumber-rails 0.3.2
Cucumber is intended to exercise the full stack. Given that, you generally don’t want to muck around with the internals at a lower level as you might with rspec.
Try something like this:
This example uses Capybara’s
visitmethod, so you’ll need to adjust accordingly, but this should give you the right idea.