Sha256: 704c86be70734f0e1b716aed24e62b41f853037c8471e461e4f67db65e83b682

Contents?: true

Size: 747 Bytes

Versions: 7

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require "spec_helpers"

describe Wayfarer::Routing::Route do
  let(:route) { Wayfarer::Routing::RootRoute.new }

  describe "#matcher" do
    subject(:matcher) { route.matcher }

    context "with child routes" do
      before { route.host("http://google.com") }

      it "returns true" do
        %w[http://example.com http://w3c.org http://google.com].each do |url|
          expect(matcher).to match(Addressable::URI.parse(url))
        end
      end
    end

    context "without child routes" do
      it "returns false" do
        %w[http://example.com http://w3c.org http://google.com].each do |url|
          expect(matcher).not_to match(Addressable::URI.parse(url))
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wayfarer-0.4.7 spec/routing/root_route_spec.rb
wayfarer-0.4.6 spec/routing/root_route_spec.rb
wayfarer-0.4.5 spec/routing/root_route_spec.rb
wayfarer-0.4.4 spec/routing/root_route_spec.rb
wayfarer-0.4.3 spec/routing/root_route_spec.rb
wayfarer-0.4.2 spec/routing/root_route_spec.rb
wayfarer-0.4.1 spec/routing/root_route_spec.rb