<commit_before>require 'rails_helper'

feature 'Budgets' do

  let(:budget) { create(:budget) }
  let(:level_two_user) { create(:user, :level_two) }

  context 'Index' do
    let(:budgets) { create_list(:budget, 3) }
    let(:last_budget) { budgets.last }

    scenario 'Show normal index with links' do
      group1 = create(:budget_group, budget: last_budget)
      group2 = create(:budget_group, budget: last_budget)

      heading1 = create(:budget_heading, group: group1)
      heading2 = create(:budget_heading, group: group2)

      last_budget.update_attributes(phase: 'informing')

      visit budgets_path


      within("#budget_heading") do
        expect(page).to have_content(last_budget.name)
        expect(page).to have_content(last_budget.description)
        expect(page).to have_content(I18n.t('budgets.phase.informing'))
        expect(page).to have_link 'Help about participatory budgets'
        expect(page).to have_link 'See all phases'
      end

      expect(page).to have_content("Accepting projects")

      last_budget.update_attributes(phase: 'publishing_prices')
      visit budgets_path

      within("#budget_heading") do
        expect(page).to have_content(I18n.t('budgets.phase.publishing_prices'))
      end

      within('#budget_info') do
        expect(page).to have_content group1.name
        expect(page).to have_content group2.name
        expect(page).to have_content heading1.name
        expect(page).to have_content last_budget.formatted_heading_price(heading1)
        expect(page).to have_content heading2.name
        expect(page).to have_content last_budget.formatted_heading_price(heading2)

        expect(page).to have_content budgets.first.name
        expect(page).to have_content budgets[2].name
      end
    end

    scenario 'Show informing index without links' do<commit_msg>Fixed errors detected in Travis<commit_after>require 'rails_helper'

feature 'Budgets' do

  let(:budget) { create(:budget) }
  let(:level_two_user) { create(:user, :level_two) }

  context 'Index' do
    let(:budgets) { create_list(:budget, 3) }
    let(:last_budget) { budgets.last }

    scenario 'Show normal index with links' do
      group1 = create(:budget_group, budget: last_budget)
      group2 = create(:budget_group, budget: last_budget)

      heading1 = create(:budget_heading, group: group1)
      heading2 = create(:budget_heading, group: group2)

      last_budget.update_attributes(phase: 'informing')

      visit budgets_path


      within("#budget_heading") do
        expect(page).to have_content(last_budget.name)
        expect(page).to have_content(last_budget.description)
        expect(page).to have_content(I18n.t('budgets.phase.informing'))
        expect(page).to have_link 'Help with participatory budgets'
        expect(page).to have_link 'See all phases'
      end

      expect(page).to have_content("Accepting projects")

      last_budget.update_attributes(phase: 'publishing_prices')
      visit budgets_path

      within("#budget_heading") do
        expect(page).to have_content(I18n.t('budgets.phase.publishing_prices'))
      end

      within('#budget_info') do
        expect(page).to have_content group1.name
        expect(page).to have_content group2.name
        expect(page).to have_content heading1.name
        expect(page).to have_content last_budget.formatted_heading_price(heading1)
        expect(page).to have_content heading2.name
        expect(page).to have_content last_budget.formatted_heading_price(heading2)

        expect(page).to have_content budgets.first.name
        expect(page).to have_content budgets[2].name
      end
    end

    scenario 'Show informing index without links' do
{'fraction_non_alphanumeric': 0.10235580828594638, 'fraction_numerical': 0.00974817221770918, 'mean_word_length': 3.577447335811648, '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': '6703694', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1114, 'n_words': 227}