summaryrefslogtreecommitdiffstats
path: root/test/functional/previews_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/previews_controller_test.rb')
-rw-r--r--test/functional/previews_controller_test.rb34
1 files changed, 19 insertions, 15 deletions
diff --git a/test/functional/previews_controller_test.rb b/test/functional/previews_controller_test.rb
index 6d8d03132..ac9090de9 100644
--- a/test/functional/previews_controller_test.rb
+++ b/test/functional/previews_controller_test.rb
@@ -32,25 +32,35 @@ class PreviewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
post :issue, :project_id => '1', :issue => {:description => 'Foo'}
assert_response :success
- assert_template 'previews/issue'
- assert_not_nil assigns(:description)
+ assert_select 'fieldset' do
+ assert_select 'legend', :text => 'Description'
+ assert_select 'p', :text => 'Foo'
+ end
end
- def test_preview_issue_notes
+ def test_preview_issue_notes_with_no_change_to_description
@request.session[:user_id] = 2
post :issue, :project_id => '1', :id => 1,
:issue => {:description => Issue.find(1).description, :notes => 'Foo'}
assert_response :success
- assert_template 'previews/issue'
- assert_not_nil assigns(:notes)
+ assert_select 'legend', :text => 'Description', :count => 0
+ assert_select 'legend', :text => 'Notes'
+ end
+
+ def test_preview_issue_notes_with_no_change_to_description
+ @request.session[:user_id] = 2
+ post :issue, :project_id => '1', :id => 1,
+ :issue => {:description => 'Changed description', :notes => 'Foo'}
+ assert_response :success
+ assert_select 'legend', :text => 'Description'
+ assert_select 'legend', :text => 'Notes'
end
def test_preview_journal_notes_for_update
@request.session[:user_id] = 2
post :issue, :project_id => '1', :id => 1, :notes => 'Foo'
assert_response :success
- assert_template 'previews/issue'
- assert_not_nil assigns(:notes)
+ assert_select 'legend', :text => 'Notes'
assert_select 'p', :text => 'Foo'
end
@@ -66,8 +76,7 @@ class PreviewsControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 2
post :issue, :project_id => '1', :id => 1, :issue => {:notes => 'notes', :project_id => 2}
assert_response :success
- assert_not_nil assigns(:issue)
- assert_not_nil assigns(:notes)
+ assert_select 'legend', :text => 'Notes'
end
def test_preview_new_news
@@ -76,20 +85,15 @@ class PreviewsControllerTest < Redmine::ControllerTest
:description => 'News description',
:summary => ''}
assert_response :success
- assert_template 'common/_preview'
assert_select 'fieldset.preview', :text => /News description/
end
- def test_existing_new_news
+ def test_preview_existing_news
get :news, :project_id => 1, :id => 2,
:news => {:title => '',
:description => 'News description',
:summary => ''}
assert_response :success
- assert_template 'common/_preview'
- assert_equal News.find(2), assigns(:previewed)
- assert_not_nil assigns(:attachments)
-
assert_select 'fieldset.preview', :text => /News description/
end
end