Sha256: 56a5e6d0176c824827810fae86192174b9a917c15ad895921d51056812359812

Contents?: true

Size: 574 Bytes

Versions: 5

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require "spec_helpers"

describe Wayfarer::Routing::Router do
  subject(:router) do
    described_class.new.tap do |router|
      router.draw do |alpha, beta|
        path alpha, to: :alpha
        path beta, to: :beta
      end
    end
  end

  describe "#invoke" do
    let(:url) { Addressable::URI.parse("https://example.com/alpha") }

    it "evaluates routes" do
      result = router.invoke(url, %w[/alpha /beta])
      expect(result).to be_a(Wayfarer::Routing::Result::Match)
      expect(result.action).to be(:alpha)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wayfarer-0.4.6 spec/routing/router_spec.rb
wayfarer-0.4.5 spec/routing/router_spec.rb
wayfarer-0.4.4 spec/routing/router_spec.rb
wayfarer-0.4.3 spec/routing/router_spec.rb
wayfarer-0.4.2 spec/routing/router_spec.rb