Use a param to trigger export rather than a separate action

In site/_resize.html.erb and site/_search.html.erb, a
params[:action] conditional is used to include code that
should only run on the index action -- but it should be run
on the export action too. Cleanest fix is to eliminate that
action entirely.
This commit is contained in:
John Firebaugh 2012-09-07 09:26:44 +01:00 committed by Tom Hughes
parent 6358f8190d
commit 8ec415b060
4 changed files with 4 additions and 16 deletions

View file

@ -36,10 +36,10 @@ class SiteControllerTest < ActionController::TestCase
)
assert_routing(
{ :path => "/export", :method => :get },
{ :controller => "site", :action => "export" }
{ :controller => "site", :action => "index", :export => true }
)
assert_recognizes(
{ :controller => "site", :action => "export", :format => "html" },
{ :controller => "site", :action => "index", :export => true, :format => "html" },
{ :path => "/export.html", :method => :get }
)
assert_routing(
@ -76,14 +76,6 @@ class SiteControllerTest < ActionController::TestCase
assert_redirected_to :controller => :user, :action => 'login', :referer => "/edit"
end
# Get the export page
def test_export
get :export
assert_response :success
assert_template 'index'
assert_site_partials
end
# Offline page
def test_offline
get :offline