<commit_before>require 'rails_helper'

RSpec.describe "home/index.html.slim", type: :view do

  include Devise::TestHelpers

  let(:user)      { create :user }
  let(:manager)   { create :manager }
  let(:admin)     { create :admin_user }

  context 'public access' do
    it 'shows a restriction message' do
      render
      expect(rendered).to have_xpath('//div', text: /This system is restricted/)
    end
  end

  context 'user access' do
    it 'displays guidance' do
      sign_in user
      render
      expect(rendered).to have_xpath('//span[@class="bold"]', text: /Check benefits/)
      expect(rendered).to have_xpath('//p', text: /eligible for benefits-based remission/)
    end
  end

  context 'manager access' do
    it 'displays a dwp checklist' do
      sign_in manager
      render
      expect(rendered).to have_xpath('//h2', text: /Manager summary for/)
      expect(rendered).to have_xpath('//th', text: 'Staff member')
    end
  end

  context 'admin access' do
    it 'displays graphs' do
      sign_in admin
      render
      expect(rendered).to have_xpath('//h2', text: 'Total')
    end
  end
end<commit_msg>Fixed test on logged out homepage<commit_after>require 'rails_helper'

RSpec.describe "home/index.html.slim", type: :view do

  include Devise::TestHelpers

  let(:user)      { create :user }
  let(:manager)   { create :manager }
  let(:admin)     { create :admin_user }

  context 'public access' do
    it 'shows a get help message' do
      render
      expect(rendered).to have_xpath('//h4', text: /Get help/)
    end
  end

  context 'user access' do
    it 'displays guidance' do
      sign_in user
      render
      expect(rendered).to have_xpath('//span[@class="bold"]', text: /Check benefits/)
      expect(rendered).to have_xpath('//p', text: /eligible for benefits-based remission/)
    end
  end

  context 'manager access' do
    it 'displays a dwp checklist' do
      sign_in manager
      render
      expect(rendered).to have_xpath('//h2', text: /Manager summary for/)
      expect(rendered).to have_xpath('//th', text: 'Staff member')
    end
  end

  context 'admin access' do
    it 'displays graphs' do
      sign_in admin
      render
      expect(rendered).to have_xpath('//h2', text: 'Total')
    end
  end
end
{'fraction_non_alphanumeric': 0.11899515204936095, 'fraction_numerical': 0.0022036139268400176, 'mean_word_length': 2.8151260504201683, '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': '2220025', 'n_tokens_mistral': 747, 'n_tokens_neox': 705, 'n_words': 217}