From c3037814d8be73382c5c45152d6a158d347f3901 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Tue, 6 Sep 2022 07:56:38 -0700 Subject: [PATCH] Adding a spec to test #1591 (#1730) --- spec/lucky/action_spec.cr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/lucky/action_spec.cr b/spec/lucky/action_spec.cr index bc64a0941..ee82fdcfd 100644 --- a/spec/lucky/action_spec.cr +++ b/spec/lucky/action_spec.cr @@ -149,7 +149,8 @@ end class OptionalRouteParams::Index < TestAction get "/complex_posts/:required/?:optional_1/?:optional_2" do - plain_text "test" + opt = params.get?(:optional_1) + plain_text "test #{required} #{optional_1} #{optional_2} #{opt}" end end @@ -375,6 +376,11 @@ describe Lucky::Action do response = Tests::PlainActionWithCustomContentType.new(build_context, params).call response.content_type.should eq "very/plain; charset=utf-8" end + + it "renders with optional path params" do + response = OptionalRouteParams::Index.new(build_context("/complex_posts/1/2/3"), {"required" => "1", "optional_1" => "2", "optional_2" => "3"}).call + response.body.to_s.should eq("test 1 2 3 2") + end end describe ".query_param_declarations" do