<commit_before>require File.expand_path("../../test_helper", __FILE__)

# :stopdoc:
class PagesControllerTest < ActionController::TestCase
  setup :create_page

  test "show page" do
    get :show, :path => "plain"
  end

  test "render child page" do
    root = Page.create!(:body => "<h1>Welcome</h1>")
    root.children.create!(:body => "<h2>Child</h2>", :title => "Child")

    get :show, :path => "child"
    assert_select("h2", :text => "Child")
  end
  
  test "render child's child" do
    root = Page.create!(:body => "<h1>Welcome</h1>")
    child = root.children.create!(:body => "<h2>Child</h2>", :title => "Child")
    child_child = child.children.create!(:body => "<h3>Nested</h3>", :title => "Nested")

    get :show, :path => "child/nested"
    assert_select("h3", :text => "Nested")
  end
  
  def test_index
    root = Page.create!(:body => "<h1>Welcome</h1>")
    child = root.children.create!(:body => "<h2>Child</h2>", :title => "Child")
    child_child = child.children.create!(:body => "<h3>Nested</h3>", :title => "Nested")<commit_msg>Make test method names consistent<commit_after>require File.expand_path("../../test_helper", __FILE__)

# :stopdoc:
class PagesControllerTest < ActionController::TestCase
  setup :create_page

  test "show page" do
    get :show, :path => "plain"
  end

  test "render child page" do
    root = Page.create!(:body => "<h1>Welcome</h1>")
    root.children.create!(:body => "<h2>Child</h2>", :title => "Child")

    get :show, :path => "child"
    assert_select("h2", :text => "Child")
  end
  
  test "render child's child" do
    root = Page.create!(:body => "<h1>Welcome</h1>")
    child = root.children.create!(:body => "<h2>Child</h2>", :title => "Child")
    child_child = child.children.create!(:body => "<h3>Nested</h3>", :title => "Nested")

    get :show, :path => "child/nested"
    assert_select("h3", :text => "Nested")
  end
  
  test "index" do
    root = Page.create!(:body => "<h1>Welcome</h1>")
    child = root.children.create!(:body => "<h2>Child</h2>", :title => "Child")
    child_child = child.children.create!(:body => "<h3>Nested</h3>", :title => "Nested")
{'fraction_non_alphanumeric': 0.21151146467009826, 'fraction_numerical': 0.016846045858680395, 'mean_word_length': 3.949074074074074, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 71, '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': '4541948', 'n_tokens_mistral': 760, 'n_tokens_neox': 747, 'n_words': 162}