<commit_before>require 'rails_helper'

describe SessionsController do
  before :each do
    @user = create(:user)
  end

  describe "GET #login" do
    it "renders the login template" do
      get :login
      expect(response).to be_success
    end
  end

  describe "GET #create_session" do
    it "sets the correct session user after authenticating" do
    end

    it "redirects to root_path when given incorrect information" do
      bad_user = User.new(username: "", password: "", email: "")
      get :create_session, username: bad_user
      expect(response).to redirect_to login_path
    end
  end

  describe "GET #logout" do
    before :each do
      session[:user_id] = @user.id
    end

    it "removes the user id from session user_id" do
      get :logout
      expect(session[:user_id]).to be nil
    end

    it "redirects to the root_path" do
      get :logout
      expect(response).to redirect_to root_path
    end
  end
end
<commit_msg>Session Ctrl: Testing flash params for login.<commit_after>require 'rails_helper'

describe SessionsController do
  before :each do
    @user = create(:user)
  end

  describe "GET #login" do
    it "renders the login template" do
      get :login
      expect(response).to be_success
    end
  end

  describe "GET #create_session" do
    it "sets the correct session user after authenticating" do
    end

    it "redirects to root_path when given incorrect information" do
      bad_user = User.new(username: "", password: "", email: "")
      get :create_session, username: bad_user
      expect(response).to redirect_to login_path
    end

    # describe "sets flash parameters" do
    #   it "on success to welcome specific user" do
    #     get :create_session, { user_input: @user.username }
    #     expect(flash[:success]).to eq("Welcome back, #{@user.username}!")
    #   end
    # end
  end

  describe "GET #logout" do
    before :each do
      session[:user_id] = @user.id
    end

    it "removes the user id from session user_id" do
      get :logout
      expect(session[:user_id]).to be nil
    end

    it "redirects to the root_path" do
      get :logout
      expect(response).to redirect_to root_path
    end
  end
end

{'fraction_non_alphanumeric': 0.08276489313324238, 'fraction_numerical': 0.0, 'mean_word_length': 2.8128249566724435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1359902', 'n_tokens_mistral': 677, 'n_tokens_neox': 654, 'n_words': 233}