Sha256: a08cf9c6d922c88d25339000ee7af9e99d920a968981001843cfb0e8df197ff4

Contents?: true

Size: 978 Bytes

Versions: 7

Compression:

Stored size: 978 Bytes

Contents

# frozen_string_literal: true

# Test gem works

page = GenericTest.pages.first
links = page.links

RSpec.describe 'Links' do
  it 'counts correctly (not include invalid)' do
    expect(links.size).to eq 3
  end
  context 'successful' do
    it 'external page' do
      expect(Checker.link_status(links[0].href)).to be_between 200, 399
    end
    it 'internal link' do
      expect(Checker.link_status(links[2].href)).to be_between 200, 399
    end
  end
  it 'broken causes failure' do
    puts page.links[1].text
    puts page.links[1].href
    expect(Checker.link_status(links[1].href)).to eq 404
  end
end

RSpec.describe 'Emails' do
  it 'counts correctly' do
    expect(page.emails.size).to eq 2
  end
  context 'validate' do
    it 'accepts valid email' do
      expect(Checker.valid_email?(page.emails[0])).to be nil
    end
    it 'returns invalid email error' do
      expect(Checker.valid_email?(page.emails[1])).to eq 'Domain name not registered'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
generic_test-0.3.1 spec/test_gem/page_spec.rb
generic_test-0.3.0 spec/test_gem/page_spec.rb
generic_test-0.2.2 spec/test_gem/page_spec.rb
generic_test-0.2.1 spec/test_gem/page_spec.rb
generic_test-0.2.0 spec/test_gem/page_spec.rb
generic_test-0.1.13 spec/test_gem/page_spec.rb
generic_test-0.1.12 spec/test_gem/page_spec.rb