<commit_before>require 'spec_helper'

describe "Project" do
  before(:each) do
    @user = FactoryGirl.create(:user)
    @admin = FactoryGirl.create(:admin)
    @project = FactoryGirl.create(:project, users: [@user, @admin])
    @project_no_entries = FactoryGirl.create(:project, users: [@user, @admin])

    login_user_with_request(@admin)
    visit "/admin"
  end

  describe "GET /projects" do
    it "lists existing projects" do
      page.should have_content(@project.name)
      page.should have_content(@project_no_entries.name)
    end

    it "lists entries per project" do
      entry = FactoryGirl.create(:entry, project_id: @project.id, user_id: @user.id)
      entry_previous = FactoryGirl.create(:entry, date: 1.month.ago, project_id: @project.id, user_id: @user.id)
      entry_next = FactoryGirl.create(:entry, date: 1.month.from_now, project_id: @project.id, user_id: @user.id)

      first(:link, "View").click
      page.should have_content(entry.description)

      first(:link, 1.month.ago.strftime("%B")).click
      page.should have_content(entry_previous.description)

      first(:link, Date.today.strftime("%B")).click
      first(:link, 1.month.from_now.strftime("%B")).click
      page.should have_content(entry_next.description)
    end

    it "shows no entries for project which has none" do
      entry = FactoryGirl.create(:entry, project: @project_no_entries, user: @user)
      entry_previous = FactoryGirl.create(:entry, date: 1.month.ago, project: @project_no_entries, user: @user)
      entry_next = FactoryGirl.create(:entry, date: 1.month.from_now, project: @project_no_entries, user: @user)
<commit_msg>Style: remove _id factory setting<commit_after>require 'spec_helper'

describe "Project" do
  before(:each) do
    @user = FactoryGirl.create(:user)
    @admin = FactoryGirl.create(:admin)
    @project = FactoryGirl.create(:project, users: [@user, @admin])
    @project_no_entries = FactoryGirl.create(:project, users: [@user, @admin])

    login_user_with_request(@admin)
    visit "/admin"
  end

  describe "GET /projects" do
    it "lists existing projects" do
      page.should have_content(@project.name)
      page.should have_content(@project_no_entries.name)
    end

    it "lists entries per project" do
      entry = FactoryGirl.create(:entry, project_id: @project.id, user: @user)
      entry_previous = FactoryGirl.create(:entry, date: 1.month.ago, project: @project, user: @user)
      entry_next = FactoryGirl.create(:entry, date: 1.month.from_now, project: @project, user: @user)

      first(:link, "View").click
      page.should have_content(entry.description)

      first(:link, 1.month.ago.strftime("%B")).click
      page.should have_content(entry_previous.description)

      first(:link, Date.current.strftime("%B")).click
      first(:link, 1.month.from_now.strftime("%B")).click
      page.should have_content(entry_next.description)
    end

    it "shows no entries for project which has none" do
      entry = FactoryGirl.create(:entry, project: @project_no_entries, user: @user)
      entry_previous = FactoryGirl.create(:entry, date: 1.month.ago, project: @project_no_entries, user: @user)
      entry_next = FactoryGirl.create(:entry, date: 1.month.from_now, project: @project_no_entries, user: @user)

{'fraction_non_alphanumeric': 0.13170731707317074, 'fraction_numerical': 0.003658536585365854, 'mean_word_length': 4.1265625, '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': '7466343', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1012, 'n_words': 232}