# frozen_string_literal: true require "spec_helpers" describe "Pages" do let(:url) { test_app_path("git-scm.com/book/en/v2.html") } describe Wayfarer::Base do specify do class self.class::DummyJob < Wayfarer::Base extend SpecHelpers include RSpec::Matchers route { host test_app_host, to: :index } def index expect(page.url).to eq("http://test:9876/git-scm.com/book/en/v2.html") expect(page.status_code).to be(200) expect(page.body).not_to be_empty expect(page.headers.count).to be(9) expect(page.meta.links.all.count).to be(157) expect(page.meta.links.internal.count).to be(102) expect(page.meta.links.external.count).to be(55) end end self.class::DummyJob.crawl(url) perform_enqueued_jobs end end describe Wayfarer::Handler do specify do class self.class::DummyJob < Wayfarer::Base extend SpecHelpers route { host test_app_host, to: DummyHandler } class DummyHandler < Wayfarer::Handler include RSpec::Matchers route { to :index } def index expect(page.url).to eq("http://test:9876/git-scm.com/book/en/v2.html") expect(page.status_code).to be(200) expect(page.body).not_to be_empty expect(page.headers.count).to be(9) expect(page.meta.links.all.count).to be(157) expect(page.meta.links.internal.count).to be(102) expect(page.meta.links.external.count).to be(55) end end end self.class::DummyJob.crawl(url) perform_enqueued_jobs end end end