diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-22 17:47:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-22 17:47:11 +0000 |
commit | bda78a4679bc947dfd42ab92adfc043afd1d2f60 (patch) | |
tree | 39ad1356f3024f2dd9ee3a8710e8d9bd46334efc /test/functional/wiki_controller_test.rb | |
parent | b56f77322ac2f6a900ba011e767446e17401cf6f (diff) | |
download | redmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.tar.gz redmine-bda78a4679bc947dfd42ab92adfc043afd1d2f60.zip |
Adds "New wiki page" link to create a new wiki page (#5536).
git-svn-id: http://svn.redmine.org/redmine/trunk@15346 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/wiki_controller_test.rb')
-rw-r--r-- | test/functional/wiki_controller_test.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 82aca52d0..cd3bf0a76 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -183,6 +183,55 @@ class WikiControllerTest < ActionController::TestCase assert_select 'textarea[name=?]', 'content[text]' end + def test_get_new + @request.session[:user_id] = 2 + + get :new, :project_id => 'ecookbook' + assert_response :success + assert_template 'new' + end + + def test_get_new_xhr + @request.session[:user_id] = 2 + + xhr :get, :new, :project_id => 'ecookbook' + assert_response :success + assert_template 'new' + end + + def test_post_new_with_valid_title_should_redirect_to_edit + @request.session[:user_id] = 2 + + post :new, :project_id => 'ecookbook', :title => 'New Page' + assert_redirected_to '/projects/ecookbook/wiki/New_Page' + end + + def test_post_new_xhr_with_valid_title_should_redirect_to_edit + @request.session[:user_id] = 2 + + xhr :post, :new, :project_id => 'ecookbook', :title => 'New Page' + assert_response :success + assert_equal 'window.location = "/projects/ecookbook/wiki/New_Page"', response.body + end + + def test_post_new_with_invalid_title_should_display_errors + @request.session[:user_id] = 2 + + post :new, :project_id => 'ecookbook', :title => 'Another page' + assert_response :success + assert_template 'new' + assert_select_error 'Title has already been taken' + end + + def test_post_new_xhr_with_invalid_title_should_display_errors + @request.session[:user_id] = 2 + + xhr :post, :new, :project_id => 'ecookbook', :title => 'Another page' + assert_response :success + assert_template 'new' + assert_include 'Title has already been taken', response.body + end + def test_create_page @request.session[:user_id] = 2 assert_difference 'WikiPage.count' do |