diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-19 20:06:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-19 20:06:01 +0000 |
commit | bb5ccb870ce312cada7d8c95f1cba655cd9468ac (patch) | |
tree | 088f27f2fbce9bf65e6566f0d449eb14d3237c9b /test/functional/previews_controller_test.rb | |
parent | 34828e18161c9886f87ec17696b55f51983fac9b (diff) | |
download | redmine-bb5ccb870ce312cada7d8c95f1cba655cd9468ac.tar.gz redmine-bb5ccb870ce312cada7d8c95f1cba655cd9468ac.zip |
Removes calls to #assert_template and #assigns in functional tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15715 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/previews_controller_test.rb')
-rw-r--r-- | test/functional/previews_controller_test.rb | 34 |
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 |