Sha256: 3a6d7d2127c02c362936209134634c9cd98c7d62648bec60451f11df84e9350d

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe 'Scripts test' do

  it 'fails for broken external src' do
    file = "#{FIXTURES_DIR}/scripts/script_broken_external.html"
    proofer = run_proofer(file)
    expect(proofer.failed_tests.first).to match(/failed: 0 Couldn't resolve host name/)
  end

  it 'works for valid internal src' do
    file = "#{FIXTURES_DIR}/scripts/script_valid_internal.html"
    proofer = run_proofer(file)
    expect(proofer.failed_tests).to eq []
  end

  it 'fails for missing internal src' do
    file = "#{FIXTURES_DIR}/scripts/script_missing_internal.html"
    proofer = run_proofer(file)
    expect(proofer.failed_tests.first).to match(/doesnotexist.js does not exist \(line 5\)/)
  end

  it 'works for present content' do
    file = "#{FIXTURES_DIR}/scripts/script_content.html"
    proofer = run_proofer(file)
    expect(proofer.failed_tests).to eq []
  end

  it 'fails for absent content' do
    file = "#{FIXTURES_DIR}/scripts/script_content_absent.html"
    proofer = run_proofer(file)
    expect(proofer.failed_tests.first).to match(/script is empty and has no src attribute/)
  end

  it 'works for broken script within pre' do
    script_pre = "#{FIXTURES_DIR}/scripts/script_in_pre.html"
    proofer = run_proofer(script_pre)
    expect(proofer.failed_tests).to eq []
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
html-proofer-2.2.0 spec/html/proofer/scripts_spec.rb
html-proofer-2.1.0 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.6 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.5 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.4 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.3 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.2 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.1 spec/html/proofer/scripts_spec.rb
html-proofer-2.0.0 spec/html/proofer/scripts_spec.rb