Sha256: ec122a50d2c7acbb0a466eb84e2b1de5b126fe7003c414458c6c4fa99af919b7

Contents?: true

Size: 1021 Bytes

Versions: 2

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true

GenericTest.pages.each do |page|
  links = page.links
  RSpec.describe "Checking broken links at #{page.url}" do
    links.each_with_index do |link, index|
      next unless link.href && !link.href.empty?

      it "Link (#{index}) #{link.text} to '#{link.href}' responds" do
        expect(Checker.link_status(link.href)).to be_between 200, 399
      end
    end
  end
  RSpec.describe 'Page content' do
    spellcheck_report = SpellCheck::ProofReader.check(page.html)
    context 'does not have common spelling mistakes' do
      it 'has no mistakes' do
        expect(spellcheck_report.status).to eq 'Accept'
      end
      spellcheck_report.errata.group_by(&:line_number).each do |line_number, mistakes|
        context "Line #{line_number}" do
          mistakes.each_with_index do |mistake, index|
            it "(#{index + 1}) #{mistake.pattern}" do
              expect(mistake.pattern).to eq mistake.expected
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
generic_test-0.1.2 spec/generic_test_spec.rb
generic_test-0.1.1 spec/generic_test_spec.rb