summaryrefslogtreecommitdiffstats
path: root/test/functional/wiki_controller_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-10-13 17:13:50 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-10-13 17:13:50 +0000
commite8468b51cc7c0725e1f59d4f2f2c828ffcd080ce (patch)
tree8b8e18f7decbf5952ecdc5b213f43be1df753983 /test/functional/wiki_controller_test.rb
parent718816c5d4b0c45ce1def155c9f517fb5ac91e35 (diff)
downloadredmine-e8468b51cc7c0725e1f59d4f2f2c828ffcd080ce.tar.gz
redmine-e8468b51cc7c0725e1f59d4f2f2c828ffcd080ce.zip
Refactor: extract method in WikiController#special to create a new #export method
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4251 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r--test/functional/wiki_controller_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 76aa02467..6b0a6cc5c 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -256,6 +256,34 @@ class WikiControllerTest < ActionController::TestCase
:child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' },
:content => 'Another page' } }
end
+
+ context "GET :export" do
+ context "with an authorized user to export the wiki" do
+ setup do
+ @request.session[:user_id] = 2
+ get :export, :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_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
+ get :export, :id => 'ecookbook'
+
+ should_respond_with :redirect
+ should_redirect_to('wiki index') { {:action => 'index', :id => @project, :page => nil} }
+ end
+ end
+ end
def test_not_found
get :index, :id => 999