You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: auth_manager_spec.rb
    path of file: ./repos/discourse/spec/lib/second_factor
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

RSpec.describe SecondFactor::AuthManager do
  fab!(:user)
  let(:guardian) 
    
  def stage_challenge(successful:)
    request = create_request(request_method: "POST", path: "/abc/xyz")
    action = create_action(request)
    action.expects(:no_second_factors_enabled!).never
    action
      .expects(:second_factor_auth_required!)
      .with({ random_param: "hello" })
      .returns({ callback_params: { call_me_back: 4314 } })
      .once
    manager = create_manager(action)
    secure_session = {}
    expect { manager.run!(request, { random_param: "hello" }, secure_session) }.to raise_error(
      SecondFactor::AuthManager::SecondFactorRequired,
    ) do |ex|
      expect(ex.nonce).to be_present
    end

    challenge =
      JSON.parse(secure_session["current_second_factor_auth_challenge"]).deep_symbolize_keys

    if successful
      challenge[:successful] = true
      secure_session["current_second_factor_auth_challenge"] = challenge.to_json
    end