# frozen_string_literal: true require "spec_helpers" describe "Steering" 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 RSpec::Matchers route do |a, b| expect(a).to eq("foobar") expect(b).to eq("barqux") end steer do |task| [task.batch, "barqux"] end end self.class::DummyJob.crawl(url, batch: "foobar") perform_enqueued_jobs end end describe Wayfarer::Handler do specify do class self.class::DummyJob < Wayfarer::Base route do |_a, _b| to DummyHandler end steer do |_task| [123, "barqux"] end class DummyHandler < Wayfarer::Handler extend RSpec::Matchers route do |a, b| expect(a).to eq("foobar") expect(b).to eq("fooz") end steer do |task| [task.batch, "fooz"] end end end self.class::DummyJob.crawl(url, batch: "foobar") perform_enqueued_jobs end end end