hanami/router

Failing edge cases for optional variables

jandudulski opened this issue · 0 comments

I would like to use such pattern: /(something/:optional/)and/:always but router doesn't catch it. Failing test:

    describe "optional variable with variable" do
      let(:router) do
        described_class.new do
          get "/(test1/:foo/)test2/:bar", as: :variable, to: RecognitionTestCase.endpoint("variable")
        end
      end

      it "recognizes route(s)" do
        runner.run!([
          [:variable, "/test1/foo/test2/bar", {foo: "foo", bar: "bar"}],
          [:variable, "/test2/bar", {foo: nil, bar: "bar"}]
        ])
      end
    end
 Failure/Error: expect(name).to be_nil

  expected: nil
       got: :variable

I'm not sure if it's bug or my bad usage?