I don't know where to put this post, but theme of this more similar to my issue.
I have trite signin system, like this:
ApplicationController: include SessionsHelper
private
helper_method :current_user
def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end
SessionsHelper: def is_admin? @current_user && @current_user.id == 1 end
features/support/env.rb: World(SessionsHelper)
So, if I test
is_admin?.should be_true
it returns:
expected nil to be true (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/users/add_user.rb:23:in /^I should
signin$/'
features/users/add_user.feature:13:in
And I should signin'
But I signed in! Why? What's the way to test authentication system from scratch?