# frozen_string_literal: true require "spec_helpers" describe "URL parameters" 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 do to :index, host: test_app_host do path "git-scm.com/book/:lang/:file" end end def index expect(params).to eq("lang" => "en", "file" => "v2.html") 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 do to DummyHandler, host: test_app_host do path "git-scm.com/book/:lang/:file" end end class DummyHandler < Wayfarer::Handler include RSpec::Matchers route { to :index } def index expect(params).to eq("lang" => "en", "file" => "v2.html") end end end self.class::DummyJob.crawl(url) perform_enqueued_jobs end end end