diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-01 20:02:39 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-01 20:02:39 +0000 |
commit | 53d5ff299af271ae49c52d72cc416b2f020b415f (patch) | |
tree | 1d099916be92b3bdafee9cdc9ac1edf6255d0997 /test/functional/wiki_controller_test.rb | |
parent | 13dca2fd3dd49bd38a364f97dad7e146e911c04e (diff) | |
download | redmine-53d5ff299af271ae49c52d72cc416b2f020b415f.tar.gz redmine-53d5ff299af271ae49c52d72cc416b2f020b415f.zip |
Test cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8463 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 53 |
1 files changed, 20 insertions, 33 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 + assert_select "a[name=?]", "CookBook_documentation" + assert_select "a[name=?]", "Another_page" + assert_select "a[name=?]", "Page_with_an_inline_image" + end - context "with an unauthorized user" do - setup do - get :export, :project_id => 'ecookbook' + def test_export_without_permission + get :export, :project_id => 'ecookbook' - should_respond_with :redirect - should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} } - end - end + assert_response 302 end - context "GET :date_index" do - setup do - get :date_index, :project_id => 'ecookbook' - end + def test_date_index + get :date_index, :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 :success + assert_template 'date_index' + assert_not_nil assigns(:pages) + assert_not_nil assigns(:pages_by_date) - should "include atom link" do - assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} - end + assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} end def test_not_found |