It seems I need to directly override the authentication mechanism in Before do ... end-block
So, I ended up with hooks.rb, placed in the features/support/file, rewriting my method logged_in?and current_user.
Before do
MySinatraApplicationClass.class_eval do
helpers do
def logged_in?
return true
end
def current_user
"Walter"
end
end
end
end
The only thing I needed to take care of was that no other actions in the application are directly read from session, but these helpers use.
Unfortunately, this way of handling Sinatra session applications through Cucumber has already been described elsewhere, and I just thought my problem was different.
source
share