summaryrefslogtreecommitdiffstats
path: root/test/functional/journals_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 19:10:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-19 19:10:18 +0000
commit3eaa998c28eb5f5dcbe0af6181ac28521c92f75d (patch)
tree0b4087ddbefa9765fc853039fb4ad8507ffc19f8 /test/functional/journals_controller_test.rb
parente8469e2c5b41e59a1a204ac730e2c3ab9261b8ff (diff)
downloadredmine-3eaa998c28eb5f5dcbe0af6181ac28521c92f75d.tar.gz
redmine-3eaa998c28eb5f5dcbe0af6181ac28521c92f75d.zip
Removes RJS from JournalsController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10054 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/journals_controller_test.rb')
-rw-r--r--test/functional/journals_controller_test.rb41
1 files changed, 25 insertions, 16 deletions
diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb
index a12872e40..652edf68d 100644
--- a/test/functional/journals_controller_test.rb
+++ b/test/functional/journals_controller_test.rb
@@ -54,47 +54,56 @@ class JournalsControllerTest < ActionController::TestCase
def test_reply_to_issue
@request.session[:user_id] = 2
- get :new, :id => 6
+ xhr :get, :new, :id => 6
assert_response :success
- assert_select_rjs :show, "update"
+ assert_template 'new'
+ assert_equal 'text/javascript', response.content_type
+ assert_include '> This is an issue', response.body
end
def test_reply_to_issue_without_permission
@request.session[:user_id] = 7
- get :new, :id => 6
+ xhr :get, :new, :id => 6
assert_response 403
end
def test_reply_to_note
@request.session[:user_id] = 2
- get :new, :id => 6, :journal_id => 4
+ xhr :get, :new, :id => 6, :journal_id => 4
assert_response :success
- assert_select_rjs :show, "update"
+ assert_template 'new'
+ assert_equal 'text/javascript', response.content_type
+ assert_include '> A comment with a private version', response.body
end
- def test_get_edit
+ def test_edit_xhr
@request.session[:user_id] = 1
xhr :get, :edit, :id => 2
assert_response :success
- assert_select_rjs :insert, :after, 'journal-2-notes' do
- assert_select 'form[id=journal-2-form]'
- assert_select 'textarea'
- end
+ assert_template 'edit'
+ assert_equal 'text/javascript', response.content_type
+ assert_include 'textarea', response.body
end
- def test_post_edit
+ def test_update_xhr
@request.session[:user_id] = 1
xhr :post, :edit, :id => 2, :notes => 'Updated notes'
assert_response :success
- assert_select_rjs :replace, 'journal-2-notes'
+ assert_template 'update'
+ assert_equal 'text/javascript', response.content_type
assert_equal 'Updated notes', Journal.find(2).notes
+ assert_include 'journal-2-notes', response.body
end
- def test_post_edit_with_empty_notes
+ def test_update_xhr_with_empty_notes_should_delete_the_journal
@request.session[:user_id] = 1
- xhr :post, :edit, :id => 2, :notes => ''
- assert_response :success
- assert_select_rjs :remove, 'change-2'
+ assert_difference 'Journal.count', -1 do
+ xhr :post, :edit, :id => 2, :notes => ''
+ assert_response :success
+ assert_template 'update'
+ assert_equal 'text/javascript', response.content_type
+ end
assert_nil Journal.find_by_id(2)
+ assert_include 'change-2', response.body
end
end