<commit_before>require 'test_helper'

class UsersControllerTest < ActionController::TestCase
  setup do
    @user = users(:user1)
    @user.save

    @params = {
      user:{
        user_name: "tester1",
        email: "<EMAIL>",
        password: "<PASSWORD>"
      }
    }
  end

  teardown do
    @user = nil
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:users), "@users is nil"
  end

  test "should get show" do
    get(:show, {id: @user.id}, nil)
    assert_response :success
    assert_not_nil assigns(:user), "@user is nil"
  end

  test "should get new" do
    get :new

    user = assigns(:user)

    assert user.new_record?
    assert_response :success
  end

  # test "should get create" do
  #   get :create, user: @params
  #   assert_response :success
  # end

  test "should create new user" do
    post :create, @params
    #assert_redirected_to user_url
    assert_response :redirect
  end

  test "should get edit" do
    get(:edit, {id: @user.id}, nil)
    assert_response :success
    assert_not_nil assigns(:user), "@user is nil"
  end

  # test "should update user" do
  #   put :update, @user, user_name: "New"
  #   #assert_redirected_to user_url
  #   assert_response :success
  #   assert_not_nil assigns(:user), "@user is nil"
  # end

  test "should get destroy" do
    get(:destroy, {id: @user.id}, nil)
    assert_redirected_to users_url
    assert_not_nil assigns(:user), "@user is nil"
  end
end<commit_msg>Modify tests for proper assertions and format. Fixes #33<commit_after>require 'test_helper'

class UsersControllerTest < ActionController::TestCase
  # *********** Stuff available after a valid request ************
  # puts "assigns", assigns
  # puts "cookies", cookies
  # puts "flash", flash
  # puts "session", session
  # puts "controller", @controller
  # puts "request", @request
  # puts "response", @response.@status

  setup do
    @user = users(:user1)
    @user.save

    @params = {
      user:{
        user_name: "tester1",
        email: "<EMAIL>",
        password: "<PASSWORD>"
      }
    }
  end

  teardown do
    @user = nil
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:users), "@users is nil"
  end

  test "should get show" do
    get(:show, {id: @user.id}, nil)
    assert_response :success
    assert_not_nil assigns(:user), "@user is nil"
  end

  test "should get new" do
    get :new

    user = assigns(:user)

    assert user.new_record?
    assert_response :success
  end

  test "should get create" do
    get :create, user: @params
    puts "user get", @response
    assert_response :success
  end

  test "should create new user" do
    post :create, @params
    puts "create new user", @assigns
    assert_redirected_to user_url(@assigns["user"].id)
    assert_response :redirect
  end

  test "should get edit" do
    get(:edit, {id: @user.id}, nil)
    assert_response :success
    assert_not_nil assigns(:user), "@user is nil"
  end

  test "should update user" do
    put :update, id: @user.id, user: {email: "<EMAIL>"}
    assert_redirected_to user_url(@assigns["user"].id)
  end

  test "should get destroy" do
    get(:destroy, {id: @user.id}, nil)
    assert_redirected_to users_url
    assert_not_nil assigns(:user), "@user is nil"
  end
end
{'fraction_non_alphanumeric': 0.11694510739856802, 'fraction_numerical': 0.0017899761336515514, 'mean_word_length': 3.059322033898305, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, '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': '661722', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1084, 'n_words': 340}