diff --git a/config/routes.rb b/config/routes.rb index 2b29e6e5..a8c2c9f9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -57,7 +57,7 @@ get '/editors/lookup/:login', to: "editors#lookup" get '/papers/lookup/:id', to: "papers#lookup" get '/papers/in/:language', to: "papers#filter", as: 'papers_by_language' - get '/papers/by/:author', to: "papers#filter", as: 'papers_by_author' + get '/papers/by/:author', to: "papers#filter", as: 'papers_by_author', constraints: { author: /.*(? "/papers/by/Author%20T.%20Lastname" + }.should route_to( + controller: "papers", + action: "filter", + author: "Author T. Lastname" + ) + end + + %w[json atom html].each do |format| + it "still allows #{format} suffix to be interpreted as format" do + { + :get => "/papers/by/Author%20T.%20Lastname.#{format}" + }.should route_to( + controller: "papers", + action: "filter", + author: "Author T. Lastname", + format: format + ) + end + + it "doesn't choke on #{format} in the middle of a name" do + { + :get => "/papers/by/Author.#{format}name%20T.%20Lastname" + }.should route_to( + controller: "papers", + action: "filter", + author: "Author.#{format}name T. Lastname", + ) + end + end + end end