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

describe "Palace Attendees", %q{
As a Applicant
I want to be able to setup Palace attendees details
So that I provide a full list of attendees for Buckingham Palace reception
} do

  let!(:user) do
    create :user, :completed_profile, role: "account_admin"
  end

  let!(:form_answer) do
    create :form_answer, :innovation, :awarded, user: user
  end

  let!(:palace_invite) do
    create :palace_invite, form_answer: form_answer, email: user.email
  end

  let!(:settings) do
    s = create(:settings, :expired_submission_deadlines)
    s.email_notifications.create!(
      kind: "winners_notification",
      trigger_at: DateTime.now - 1.year
    )

    s
  end

  before do
    login_as(user, scope: :user)
  end

  describe "Access" do
    describe "Should be buckingham palace invites stage" do
      it "should reject applicant with access denied message" do
        visit dashboard_path
        expect(page).to_not have_link("Palace Attendees")<commit_msg>[Palace Invite] Rspec fixes<commit_after>require "rails_helper"
include Warden::Test::Helpers

describe "Palace Attendees", %q{
As a Applicant
I want to be able to setup Palace attendees details
So that I provide a full list of attendees for Buckingham Palace reception
} do

  let!(:user) do
    create :user, :completed_profile, role: "account_admin"
  end

  let!(:form_answer) do
    create :form_answer, :innovation, :awarded, user: user
  end

  let!(:award_year) do
    create(:award_year)
  end

  let!(:year_settings) do
    settings = award_year.settings

    invite = settings.deadlines.where(kind: "buckingham_palace_attendees_invite").first
    invite.update_column(:trigger_at, DateTime.new(Date.current.year, 7, 14, 18, 00))

    settings.reload
  end

  let!(:palace_invite) do
    create :palace_invite, form_answer: form_answer, email: user.email
  end

  let!(:settings) do
    s = create(:settings, :expired_submission_deadlines)
    s.email_notifications.create!(
      kind: "winners_notification",
      trigger_at: DateTime.now - 1.year
    )

    s
  end

  before do
    login_as(user, scope: :user)
  end

  describe "Access" do
    describe "Should be buckingham palace invites stage" do
      it "should reject applicant with access denied message" do
        visit dashboard_path
        expect(page).to_not have_link("Palace Attendees")
{'fraction_non_alphanumeric': 0.08950874271440466, 'fraction_numerical': 0.003746877601998335, 'mean_word_length': 3.844758064516129, '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': '4889772', 'n_tokens_mistral': 802, 'n_tokens_neox': 751, 'n_words': 231}