Skip to content

Instantly share code, notes, and snippets.

@revelation
Created August 22, 2008 05:15
Show Gist options
  • Save revelation/6762 to your computer and use it in GitHub Desktop.
Save revelation/6762 to your computer and use it in GitHub Desktop.
it "should match only if all mixed conditions are satisied" do
Merb::Router.prepare do |r|
r.match!("/:blog/post/:id", :blog => %r{[a-zA-Z]}, :id => %r{[0-9]})
end
route_to("/superblog/post/123").should have_route(:blog => "superblog", :id => "123")
route_to("/superblawg/post/321").should have_route(:blog => "superblawg", :id => "321")
route_to("/superblog/post/asdf").should have_nil_route
route_to("/superblog1/post/123").should have_nil_route
route_to("/ab/12").should have_nil_route
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment