<commit_before>defmodule Gatekeeper.MemberControllerTest do
  use Gatekeeper.ConnCase

  import Gatekeeper.Factory

  alias Gatekeeper.Company
  alias Gatekeeper.Member

  @valid_attrs %{name: "<NAME>",  email: "<EMAIL>", active: true, company_id: 1}
  @invalid_attrs %{name: "", company_id: nil}

  setup do
    conn = conn()
    {:ok, conn: conn}
  end

  test "lists all entries on index", %{conn: conn} do
    company = create_company
    conn = get conn, company_member_path(conn, :index, company)
    assert html_response(conn, 200) =~ "Listing members for #{company.name}"
  end

  test "renders form for new resources", %{conn: conn} do
    company = create_company
    conn = get conn, company_member_path(conn, :new, company)
    assert html_response(conn, 200) =~ "New member of .*#{company.name}.*"
  end

  test "creates resource and redirects when data is valid", %{conn: conn} do
    company = create_company
    conn = post conn, company_member_path(conn, :create, company), member: @valid_attrs
    assert redirected_to(conn) == company_member_path(conn, :index, company)
    assert Repo.get_by(Member, @valid_attrs)
  end

  test "does not create resource and renders errors when data is invalid", %{conn: conn} do
    company = create_company
    conn = post conn, company_member_path(conn, :create, company), member: @invalid_attrs
    assert html_response(conn, 200) =~ "New member"
  end

  test "shows chosen resource", %{conn: conn} do
    company = create_company
    member = create_member company: company
    conn = get conn, company_member_path(conn, :show, company, member)<commit_msg>Adjust tests to match HTML output<commit_after>defmodule Gatekeeper.MemberControllerTest do
  use Gatekeeper.ConnCase

  import Gatekeeper.Factory

  alias Gatekeeper.Company
  alias Gatekeeper.Member

  @valid_attrs %{name: "<NAME>",  email: "<EMAIL>", active: true, company_id: 1}
  @invalid_attrs %{name: "", company_id: nil}

  setup do
    conn = conn()
    {:ok, conn: conn}
  end

  test "lists all entries on index", %{conn: conn} do
    company = create_company
    conn = get conn, company_member_path(conn, :index, company)
    assert html_response(conn, 200) =~ ~r/Listing members for .*#{company.name}/
  end

  test "renders form for new resources", %{conn: conn} do
    company = create_company
    conn = get conn, company_member_path(conn, :new, company)
    assert html_response(conn, 200) =~ ~r/New member of .*#{company.name}/
  end

  test "creates resource and redirects when data is valid", %{conn: conn} do
    company = create_company
    conn = post conn, company_member_path(conn, :create, company), member: @valid_attrs
    assert redirected_to(conn) == company_member_path(conn, :index, company)
    assert Repo.get_by(Member, @valid_attrs)
  end

  test "does not create resource and renders errors when data is invalid", %{conn: conn} do
    company = create_company
    conn = post conn, company_member_path(conn, :create, company), member: @invalid_attrs
    assert html_response(conn, 200) =~ "New member"
  end

  test "shows chosen resource", %{conn: conn} do
    company = create_company
    member = create_member company: company
    conn = get conn, company_member_path(conn, :show, company, member)
{'fraction_non_alphanumeric': 0.10817455439459127, 'fraction_numerical': 0.006146281499692686, 'mean_word_length': 4.233118971061093, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4813402', 'n_tokens_mistral': 1029, 'n_tokens_neox': 977, 'n_words': 332}