<commit_before>#NOTE: start the middleman as in readme, then run bundle exec rspec

require 'capybara/rspec'
require 'capybara/poltergeist'
require 'pry'

unless `which phantomjs`.empty?
  Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, { :inspector => true, })
  end
  Capybara.javascript_driver = :poltergeist
end

describe "TOC", :type => :feature do
  include Capybara::DSL

  before do
    Capybara.app_host = 'http://localhost:4567'
    unless `which phantomjs`.empty?
      Capybara.current_driver = :poltergeist
    else
      Capybara.current_driver = :selemium
    end
    Capybara.run_server = false
  end

  it "Within-guide page link" do
    visit "/guides/models/finding-records"
    find('a.next-guide').text.should =~ /Working with Records/
  end

  it "Another within-guide page link " do
    visit "/guides/object-model/bindings"
    find('a.next-guide').text.should =~ /Reopening Classes and Instances/
  end

  it "Shows next section link" do
    visit "/guides/views/manually-managing-view-hierarchy"
    find('a.next-guide').text.should =~ /We're done with Views/
    find('a.next-guide').text.should =~ /Next up: /
    find('a.next-guide').text.should =~ /Enumerables/
    find('a.next-guide').text.should =~ /Introduction/
  end

  it "Shows previous section link" do
    visit "/guides/routing"<commit_msg>Typo in toc_spec.rb :selemium -> :selenium<commit_after>#NOTE: start the middleman as in readme, then run bundle exec rspec

require 'capybara/rspec'
require 'capybara/poltergeist'
require 'pry'

unless `which phantomjs`.empty?
  Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, { :inspector => true, })
  end
  Capybara.javascript_driver = :poltergeist
end

describe "TOC", :type => :feature do
  include Capybara::DSL

  before do
    Capybara.app_host = 'http://localhost:4567'
    unless `which phantomjs`.empty?
      Capybara.current_driver = :poltergeist
    else
      Capybara.current_driver = :selenium
    end
    Capybara.run_server = false
  end

  it "Within-guide page link" do
    visit "/guides/models/finding-records"
    find('a.next-guide').text.should =~ /Working with Records/
  end

  it "Another within-guide page link " do
    visit "/guides/object-model/bindings"
    find('a.next-guide').text.should =~ /Reopening Classes and Instances/
  end

  it "Shows next section link" do
    visit "/guides/views/manually-managing-view-hierarchy"
    find('a.next-guide').text.should =~ /We're done with Views/
    find('a.next-guide').text.should =~ /Next up: /
    find('a.next-guide').text.should =~ /Enumerables/
    find('a.next-guide').text.should =~ /Introduction/
  end

  it "Shows previous section link" do
    visit "/guides/routing"
{'fraction_non_alphanumeric': 0.12864864864864864, 'fraction_numerical': 0.002882882882882883, 'mean_word_length': 3.521172638436482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '1951386', 'n_tokens_mistral': 1008, 'n_tokens_neox': 947, 'n_words': 223}