Sha256: 90295dc4d0d662358adb1d2c50d518f22dbc662d6ba3a3abe40f86c0f4ceac9b
Contents?: true
Size: 880 Bytes
Versions: 7
Compression:
Stored size: 880 Bytes
Contents
# frozen_string_literal: true require "spec_helpers" describe Wayfarer::Routing::PathFinder do let(:route) do Wayfarer::Routing::RootRoute.new.to(:foobar) do host "example.com", path: "/:a/:b" end end subject(:result) { Wayfarer::Routing::PathFinder.result(route, Addressable::URI.parse(url)) } describe "::result" do context "with matching URL" do let(:url) { "https://example.com/alpha/beta" } it "returns a Match" do expect(result).to be_a(Wayfarer::Routing::Result::Match) expect(result.action).to be(:foobar) expect(result.params).to eq("a" => "alpha", "b" => "beta") end end context "with mismatching URL" do let(:url) { "https://yahoo.com/alpha/zyklon" } it "returns a Mismatch" do expect(result).to be_a(Wayfarer::Routing::Result::Mismatch) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems