summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/documents_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb
index 3b4424e51..28a320cb2 100644
--- a/test/functional/documents_controller_test.rb
+++ b/test/functional/documents_controller_test.rb
@@ -115,6 +115,15 @@ LOREM
assert_equal 1, ActionMailer::Base.deliveries.size
end
+ def test_create_with_failure
+ @request.session[:user_id] = 2
+ assert_no_difference 'Document.count' do
+ post :create, :project_id => 'ecookbook', :document => { :title => ''}
+ end
+ assert_response :success
+ assert_template 'new'
+ end
+
def test_edit
@request.session[:user_id] = 2
get :edit, :id => 1
@@ -130,6 +139,13 @@ LOREM
assert_equal 'test_update', document.title
end
+ def test_update_with_failure
+ @request.session[:user_id] = 2
+ put :update, :id => 1, :document => {:title => ''}
+ assert_response :success
+ assert_template 'edit'
+ end
+
def test_destroy
@request.session[:user_id] = 2
assert_difference 'Document.count', -1 do