<commit_before>RSpec.feature "Donation Site", type: :feature do
  before do
    sign_in(@user)
  end
  let(:url_prefix) { "/#{@organization.to_param}" }

  context "When a user views the index page" do
    before(:each) do
      @second = create(:donation_site, name: "Bcd")
      @first = create(:donation_site, name: "Abc")
      @third = create(:donation_site, name: "Cde")
      visit url_prefix + "/donation_sites"
    end
    scenario "the donation sites are in alphabetical order" do
      expect(page).to have_xpath("//table/tbody/tr", count: 3)
      expect(page.find(:xpath, "//table/tbody/tr[1]/td[1]")).to have_content(@first.name)
      expect(page.find(:xpath, "//table/tbody/tr[3]/td[1]")).to have_content(@third.name)
    end
  end

  scenario "User creates a new donation site" do
    visit url_prefix + "/donation_sites/new"
    donation_site_traits = attributes_for(:donation_site)
    fill_in "Name", with: donation_site_traits[:name]
    fill_in "Address", with: donation_site_traits[:address]
    click_button "Create Donation site"

    expect(page.find(".alert")).to have_content "added"
  end

  scenario "User creates a new donation site on index" do
    visit url_prefix + '/donation_sites'
    donation_site_traits = attributes_for(:donation_site)
    fill_in "donation_site_name", with: donation_site_traits[:name]
    fill_in "donation_site_address", with: donation_site_traits[:address]
    click_button "Create"
    expect(page.find('tbody tr')).to have_content(donation_site_traits[:name])
  end

  scenario "User creates a new donation site with empty attributes" do
    visit url_prefix + "/donation_sites/new"
    click_button "Create Donation site"
<commit_msg>Fixes rubocop violations.<commit_after>RSpec.feature "Donation Site", type: :feature do
  before do
    sign_in(@user)
  end
  let(:url_prefix) { "/#{@organization.to_param}" }

  context "When a user views the index page" do
    before(:each) do
      @second = create(:donation_site, name: "Bcd")
      @first = create(:donation_site, name: "Abc")
      @third = create(:donation_site, name: "Cde")
      visit url_prefix + "/donation_sites"
    end
    scenario "the donation sites are in alphabetical order" do
      expect(page).to have_xpath("//table/tbody/tr", count: 3)
      expect(page.find(:xpath, "//table/tbody/tr[1]/td[1]")).to have_content(@first.name)
      expect(page.find(:xpath, "//table/tbody/tr[3]/td[1]")).to have_content(@third.name)
    end
  end

  scenario "User creates a new donation site" do
    visit url_prefix + "/donation_sites/new"
    donation_site_traits = attributes_for(:donation_site)
    fill_in "Name", with: donation_site_traits[:name]
    fill_in "Address", with: donation_site_traits[:address]
    click_button "Create Donation site"

    expect(page.find(".alert")).to have_content "added"
  end

  scenario "User creates a new donation site on index" do
    visit url_prefix + "/donation_sites"
    donation_site_traits = attributes_for(:donation_site)
    fill_in "donation_site_name", with: donation_site_traits[:name]
    fill_in "donation_site_address", with: donation_site_traits[:address]
    click_button "Create"
    expect(page.find("tbody tr")).to have_content(donation_site_traits[:name])
  end

  scenario "User creates a new donation site with empty attributes" do
    visit url_prefix + "/donation_sites/new"
    click_button "Create Donation site"

{'fraction_non_alphanumeric': 0.12235915492957747, 'fraction_numerical': 0.0029342723004694834, 'mean_word_length': 4.212538226299694, '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': '1540159', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1103, 'n_words': 274}