Skip to content

Commit

Permalink
Fixing the content upload route. Close #94.
Browse files Browse the repository at this point in the history
Move the catch-all content route to the bottom and add a test for the mapping.
  • Loading branch information
bamnet committed May 29, 2012
1 parent 322e2bb commit acd98b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
resources :fields
end

match 'content/' => 'feeds#index'
resources :feeds do
resources :submissions, :only => [:index, :show, :update]
end
Expand Down Expand Up @@ -130,6 +129,11 @@
# just remember to delete public/index.html.
root :to => "feeds#index"

# This is the catch-all path we use for people who type /content when they
# are semantically looking for all the feeds to show the content. We put it
# here at the bottom to avoid capturing any of the restful content paths.
match 'content/' => 'feeds#index'

# See how all your routes lay out with "rake routes"

# This is a legacy wild controller route that's not recommended for RESTful applications.
Expand Down
7 changes: 6 additions & 1 deletion test/integration/routes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ class RoutesTest < ActionController::IntegrationTest
assert_recognizes({:controller => 'feeds', :action => 'index'}, "content")

# A backup way to test this
#assert_equal "/content", contents_path
assert_equal "/content", contents_path
end

test "content upload does not mix with feeds" do
assert_recognizes({:controller => 'contents', :action => 'create'}, {:path => 'content', :method => :post})
assert_recognizes({:controller => 'feeds', :action => 'index'}, {:path => 'content', :method => :get})
end

test "no screen path in frontend route" do
assert_recognizes({:controller => 'frontend/screens', :action => 'show', :id => '1'}, "frontend/1")
end
Expand Down

0 comments on commit acd98b2

Please sign in to comment.