annotate .svn/pristine/9b/9b84764d6a680557300004c2b0ad28b6829fc7d1.svn-base @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents
children
rev   line source
Chris@1517 1 # Redmine - project management software
Chris@1517 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
Chris@1517 3 #
Chris@1517 4 # This program is free software; you can redistribute it and/or
Chris@1517 5 # modify it under the terms of the GNU General Public License
Chris@1517 6 # as published by the Free Software Foundation; either version 2
Chris@1517 7 # of the License, or (at your option) any later version.
Chris@1517 8 #
Chris@1517 9 # This program is distributed in the hope that it will be useful,
Chris@1517 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1517 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1517 12 # GNU General Public License for more details.
Chris@1517 13 #
Chris@1517 14 # You should have received a copy of the GNU General Public License
Chris@1517 15 # along with this program; if not, write to the Free Software
Chris@1517 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@1517 17
Chris@1517 18 require File.expand_path('../../test_helper', __FILE__)
Chris@1517 19
Chris@1517 20 class PreviewsControllerTest < ActionController::TestCase
Chris@1517 21 fixtures :projects, :trackers, :issue_statuses, :issues,
Chris@1517 22 :enumerations, :users, :issue_categories,
Chris@1517 23 :projects_trackers,
Chris@1517 24 :roles,
Chris@1517 25 :member_roles,
Chris@1517 26 :members,
Chris@1517 27 :enabled_modules,
Chris@1517 28 :journals, :journal_details,
Chris@1517 29 :news
Chris@1517 30
Chris@1517 31 def test_preview_new_issue
Chris@1517 32 @request.session[:user_id] = 2
Chris@1517 33 post :issue, :project_id => '1', :issue => {:description => 'Foo'}
Chris@1517 34 assert_response :success
Chris@1517 35 assert_template 'previews/issue'
Chris@1517 36 assert_not_nil assigns(:description)
Chris@1517 37 end
Chris@1517 38
Chris@1517 39 def test_preview_issue_notes
Chris@1517 40 @request.session[:user_id] = 2
Chris@1517 41 post :issue, :project_id => '1', :id => 1,
Chris@1517 42 :issue => {:description => Issue.find(1).description, :notes => 'Foo'}
Chris@1517 43 assert_response :success
Chris@1517 44 assert_template 'previews/issue'
Chris@1517 45 assert_not_nil assigns(:notes)
Chris@1517 46 end
Chris@1517 47
Chris@1517 48 def test_preview_journal_notes_for_update
Chris@1517 49 @request.session[:user_id] = 2
Chris@1517 50 post :issue, :project_id => '1', :id => 1, :notes => 'Foo'
Chris@1517 51 assert_response :success
Chris@1517 52 assert_template 'previews/issue'
Chris@1517 53 assert_not_nil assigns(:notes)
Chris@1517 54 assert_tag :p, :content => 'Foo'
Chris@1517 55 end
Chris@1517 56
Chris@1517 57 def test_preview_issue_notes_should_support_links_to_existing_attachments
Chris@1517 58 Attachment.generate!(:container => Issue.find(1), :filename => 'foo.bar')
Chris@1517 59 @request.session[:user_id] = 2
Chris@1517 60 post :issue, :project_id => '1', :id => 1, :notes => 'attachment:foo.bar'
Chris@1517 61 assert_response :success
Chris@1517 62 assert_select 'a.attachment', :text => 'foo.bar'
Chris@1517 63 end
Chris@1517 64
Chris@1517 65 def test_preview_new_news
Chris@1517 66 get :news, :project_id => 1,
Chris@1517 67 :news => {:title => '',
Chris@1517 68 :description => 'News description',
Chris@1517 69 :summary => ''}
Chris@1517 70 assert_response :success
Chris@1517 71 assert_template 'common/_preview'
Chris@1517 72 assert_tag :tag => 'fieldset', :attributes => { :class => 'preview' },
Chris@1517 73 :content => /News description/
Chris@1517 74 end
Chris@1517 75
Chris@1517 76 def test_existing_new_news
Chris@1517 77 get :news, :project_id => 1, :id => 2,
Chris@1517 78 :news => {:title => '',
Chris@1517 79 :description => 'News description',
Chris@1517 80 :summary => ''}
Chris@1517 81 assert_response :success
Chris@1517 82 assert_template 'common/_preview'
Chris@1517 83 assert_equal News.find(2), assigns(:previewed)
Chris@1517 84 assert_not_nil assigns(:attachments)
Chris@1517 85
Chris@1517 86 assert_tag :tag => 'fieldset', :attributes => { :class => 'preview' },
Chris@1517 87 :content => /News description/
Chris@1517 88 end
Chris@1517 89 end