<commit_before>require 'rails_helper'
include Warden::Test::Helpers

describe "Eligibility form fulfilling", %q{
As a User
I want to be able to check eligibility to awards
} do

  let!(:user){ create(:user, :completed_profile) }
  before{ login_as user }

  context 'after filling the eligibility form' do
    it 'sees the eligibility summary page' do
      fill_form_with_all_yes
      visit dashboard_path
      expect(page).to have_content('You are eligible to apply for:')

      eligible_awards = all('article li.eligible').map(&:text)
      expect(eligible_awards).to eq(['Innovation'])
    end
  end
end

def check_first_checkbox
  all(".question-body input[type='radio']:first").first.set(true)
end

def fill_form_with_all_yes
  visit new_innovation_form_path

  7.times do
    check_first_checkbox
    click_button 'Continue'
  end

  fill_in('eligibility_number_of_innovative_products', with: 1)
  click_button 'Continue'

  3.times do |i|
    check_first_checkbox
    click_button 'Continue'
  end
end<commit_msg>Removed old eligibility spec<commit_after>require 'rails_helper'
include Warden::Test::Helpers

def check_first_checkbox
  all(".question-body input[type='radio']:first").first.set(true)
end

def fill_form_with_all_yes
  visit new_innovation_form_path

  7.times do
    check_first_checkbox
    click_button 'Continue'
  end

  fill_in('eligibility_number_of_innovative_products', with: 1)
  click_button 'Continue'

  3.times do |i|
    check_first_checkbox
    click_button 'Continue'
  end
end
{'fraction_non_alphanumeric': 0.0875, 'fraction_numerical': 0.003947368421052632, 'mean_word_length': 4.696629213483146, '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': '3868054', 'n_tokens_mistral': 523, 'n_tokens_neox': 487, 'n_words': 123}