<commit_before>#! /usr/bin/env ruby
# encoding: UTF-8

require_relative '../test_helper'

class Blog::PostIntegrationTest < ActiveSupport::IntegrationCase
  
 
  include Blog::PostsHelper
  
  def setup
    Post.destroy_all
  end
   
  
  context "with some posts" do
    
    setup do
      11.times{ |i| Factory.create(:post, :title => "Capy post #{i}", :posted_at => Time.now - i.days) }
      assert_equal 11, Post.count
    end
    
    should "get the blog page" do
      visit posts_path
      # first post
      assert has_link?("Capy post 1")
      # last post
      assert has_link?("Capy post 9")
      # archive link
      assert has_link?("View Full Archive")
      # tag link
      assert has_link?("peanut butter")
      # page two
      assert has_link?("2")
      assert has_link?("Next →")
      
      
      #assert_equal nil, page.html.match(%(<span class="translation_missing")), "Missing translation!"
      
    end
    
    should "get a blog post" do
      @post = Post.first
      visit full_post_path(@post.year, @post.month, @post.day, @post)
      within('h1') do<commit_msg>fix blog pagination test<commit_after>#! /usr/bin/env ruby
# encoding: UTF-8

require_relative '../test_helper'

class Blog::PostIntegrationTest < ActiveSupport::IntegrationCase
  
 
  include Blog::PostsHelper
  
  def setup
    Post.destroy_all
  end
   
  
  context "with some posts" do
    
    setup do
      11.times{ |i| Factory.create(:post, :title => "Capy post #{i}", :posted_at => Time.now - i.days) }
      assert_equal 11, Post.count
    end
    
    should "get the blog page" do
      visit posts_path
      # first post
      assert has_link?("Capy post 1")
      # last post
      assert has_link?("Capy post 9")
      # archive link
      assert has_link?("View Full Archive")
      # tag link
      assert has_link?("peanut butter")
      # page two
      assert has_link?("2")
      assert has_link?("Next ›")
    end
    
    should "get a blog post" do
      @post = Post.first
      visit full_post_path(@post.year, @post.month, @post.day, @post)
      within('h1') do
{'fraction_non_alphanumeric': 0.11492608488316643, 'fraction_numerical': 0.008583690987124463, 'mean_word_length': 2.4337152209492636, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '3388272', 'n_tokens_mistral': 700, 'n_tokens_neox': 672, 'n_words': 190}