spec/plugin/multi_route_spec.rb in roda-cj-0.9.6 vs spec/plugin/multi_route_spec.rb in roda-cj-1.0.0

- old
+ new

@@ -23,15 +23,25 @@ r.is "a" do "posta" end end + route(:p) do |r| + r.is do + 'p' + end + end + route do |r| r.on 'foo' do r.multi_route do "foo" end + + r.on "p" do + r.route(:p) + end end r.get do r.route("get") @@ -67,9 +77,21 @@ body('/foo/get/').should == 'get' body('/foo/get/a').should == 'geta' body('/foo/post/').should == 'post' body('/foo/post/a').should == 'posta' body('/foo/post/b').should == 'foo' + end + + it "does not have multi_route match non-String named routes" do + body('/foo/p').should == 'p' + status('/foo/p/2').should == 404 + end + + it "Can have multi_route pick up routes newly added" do + body('/foo/get/').should == 'get' + status('/foo/delete').should == 404 + app.route('delete'){|r| r.on{'delete'}} + body('/foo/delete').should == 'delete' end it "handles loading the plugin multiple times correctly" do app.plugin :multi_route body.should == 'get'