Test cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8463 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-01 20:02:39 +00:00
parent 13dca2fd3d
commit 53d5ff299a
1 changed files with 22 additions and 35 deletions

View File

@ -618,48 +618,35 @@ 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
def test_export
@request.session[:user_id] = 2
get :export, :project_id => 'ecookbook'
end
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_response :success
assert_not_nil assigns(:pages)
assert_equal "text/html", @response.content_type
assert_select "a[name=?]", "CookBook_documentation"
assert_select "a[name=?]", "Another_page"
assert_select "a[name=?]", "Page_with_an_inline_image"
end
end
context "with an unauthorized user" do
setup do
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
def test_date_index
get :date_index, :project_id => 'ecookbook'
end
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
end
def test_not_found
get :show, :project_id => 999