From 53d5ff299af271ae49c52d72cc416b2f020b415f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 1 Jan 2012 20:02:39 +0000 Subject: [PATCH] Test cleanup. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8463 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/wiki_controller_test.rb | 57 ++++++++++--------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 8f8f81759..3665a75fd 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -618,47 +618,34 @@ class WikiControllerTest < ActionController::TestCase assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} end - context "GET :export" do - context "with an authorized user to export the wiki" do - setup do - @request.session[:user_id] = 2 - get :export, :project_id => 'ecookbook' - end + def test_export + @request.session[:user_id] = 2 + get :export, :project_id => 'ecookbook' - should_respond_with :success - should_assign_to :pages - should_respond_with_content_type "text/html" - should "export all of the wiki pages to a single html file" do - assert_select "a[name=?]", "CookBook_documentation" - assert_select "a[name=?]", "Another_page" - assert_select "a[name=?]", "Page_with_an_inline_image" - end + assert_response :success + assert_not_nil assigns(:pages) + assert_equal "text/html", @response.content_type - end - - context "with an unauthorized user" do - setup do - get :export, :project_id => 'ecookbook' - - should_respond_with :redirect - should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} } - end - end + assert_select "a[name=?]", "CookBook_documentation" + assert_select "a[name=?]", "Another_page" + assert_select "a[name=?]", "Page_with_an_inline_image" end - context "GET :date_index" do - setup do - get :date_index, :project_id => 'ecookbook' - end + def test_export_without_permission + get :export, :project_id => 'ecookbook' - should_respond_with :success - should_assign_to :pages - should_assign_to :pages_by_date - should_render_template 'wiki/date_index' + assert_response 302 + end - should "include atom link" do - assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} - end + def test_date_index + get :date_index, :project_id => 'ecookbook' + + assert_response :success + assert_template 'date_index' + assert_not_nil assigns(:pages) + assert_not_nil assigns(:pages_by_date) + + assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} end def test_not_found