Failing spec: sign_in(Fabricate(:user))

I’m having an issue with the sign_in helper function, any help very much appreciated! :exploding_head: :

When used in this test, it doesn’t seem to deliver a current_user and fails with a 403 (instead of a 200)

I’m running the test like so to isolate it, but it doesn’t work either way:

LOAD_PLUGINS=1 RAILS_ENV=test rspec plugins/discourse-follow/spec/requests/follow_controller_spec.rb:32

If I add a byebug in the corresponding controller and check for current_user it is nil (hence the 403 I guess!):

Randomized with seed 50945

[5, 14] in /home/merefield/code/discourse-follow/app/controllers/follow/follow_controller.rb
    5:   def update
    6:     params.require(:username)
    7:     params.require(:follow)
    8:     byebug
    9:
=> 10:     raise Discourse::InvalidAccess.new unless current_user
   11:     raise Discourse::InvalidParameters.new if current_user.username == params[:username]
   12:
   13:     if user = User.find_by(username: params[:username])
   14:       updater = Follow::Updater.new(current_user, user)
(byebug) current_user
nil