<commit_before>require 'spec_helper'

describe 'Admin Projects' do
  let(:user) { create :user }
  let!(:projects) { [ "repo1", "repo2"].map { |repo| create :project, github_url: "http://github.com/christmas/#{repo}" } }
  subject { page }

  before do
    user.stub(:is_collaborator? => true)
    login(user)

    visit admin_projects_path
  end

  describe 'project index' do

    it "should list all projects" do
      projects.each do |project|
        should have_content project.name
      end
    end
  end

  describe 'managing projects', js: true do
    it "search for a project" do
      fill_in "_repository", with: "repo1"
      click_on "Search"

      sleep(Capybara.default_wait_time)

      should have_content "repo1"
      should_not have_content "repo2"
    end

    it "editing a project" do
      first(:link, "Edit").click

      fill_in 'Name', with: 'Pugalicious'
      click_on "Update Project"

      should have_content "Project updated successfully!"

      should have_content "PUGALICIOUS"
    end<commit_msg>only use the js hook when needed<commit_after>require 'spec_helper'

describe 'Admin Projects' do
  let(:user) { create :user }
  let!(:projects) { [ "repo1", "repo2"].map { |repo| create :project, github_url: "http://github.com/christmas/#{repo}" } }
  subject { page }

  before do
    user.stub(:is_collaborator? => true)
    login(user)

    visit admin_projects_path
  end

  describe 'project index' do

    it "should list all projects" do
      projects.each do |project|
        should have_content project.name
      end
    end
  end

  describe 'managing projects' do
    it "search for a project", js: true do
      fill_in "_repository", with: "repo1"
      click_on "Search"

      sleep(Capybara.default_wait_time)

      should have_content "repo1"
      should_not have_content "repo2"
    end

    it "editing a project", js: true do
      first(:link, "Edit").click

      fill_in 'Name', with: 'Pugalicious'
      click_on "Update Project"

      should have_content "Project updated successfully!"

      should have_content "PUGALICIOUS"
    end
{'fraction_non_alphanumeric': 0.10251542477456099, 'fraction_numerical': 0.004746084480303749, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7303421', 'n_tokens_mistral': 682, 'n_tokens_neox': 651, 'n_words': 197}