<commit_before><commit_msg>Person’s Posts index catch-up and test coverage<commit_after>require "test_helper"
require_relative "base"

module GobiertoPeople
  module People
    class PersonPostsIndexTest < ActionDispatch::IntegrationTest
      include Base

      def setup
        super
        @path = gobierto_people_person_posts_path(person)
      end

      def site
        @site ||= sites(:madrid)
      end

      def person
        @person ||= gobierto_people_people(:richard)
      end

      def latest_posts
        @latest_posts ||= [
          gobierto_people_person_posts(:richard_about_me),
          gobierto_people_person_posts(:richard_achievements)
        ]
      end

      def test_person_posts_index
        with_current_site(site) do
          visit @path

          assert has_selector?("h3", text: "#{person.name}, #{person.charge}'s blog")
        end
      end

      def test_person_posts_summary
        with_current_site(site) do
          visit @path

          within ".posts-summary" do
            latest_posts.each do |person_post|
              assert has_selector?(".person-post-excerpt", text: person_post.title)

              Array(person_post.tags).each do |person_post_tag|
                assert has_link?("##{person_post_tag}")
              end

              assert has_link?(person_post.title)
              assert has_link?("Continue reading")
              assert has_link?(person_post.person.name)
            end
          end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07763157894736843, 'fraction_numerical': 0.0006578947368421052, 'mean_word_length': 2.1104294478527605, 'pattern_counts': {'":': 0, '<': 4, '<?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': '7590158', 'n_tokens_mistral': 437, 'n_tokens_neox': 428, 'n_words': 91}