comparison test/functional/previews_controller_test.rb @ 1526:404aa68d4227

Merge from live branch
author Chris Cannam
date Thu, 11 Sep 2014 12:46:20 +0100
parents dffacf8a6908
children
comparison
equal deleted inserted replaced
1493:a5f2bdf3b486 1526:404aa68d4227
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
23 :projects_trackers, 23 :projects_trackers,
24 :roles, 24 :roles,
25 :member_roles, 25 :member_roles,
26 :members, 26 :members,
27 :enabled_modules, 27 :enabled_modules,
28 :workflows,
29 :journals, :journal_details, 28 :journals, :journal_details,
30 :news 29 :news
31 30
32 def test_preview_new_issue 31 def test_preview_new_issue
33 @request.session[:user_id] = 2 32 @request.session[:user_id] = 2
34 post :issue, :project_id => '1', :issue => {:description => 'Foo'} 33 post :issue, :project_id => '1', :issue => {:description => 'Foo'}
35 assert_response :success 34 assert_response :success
36 assert_template 'preview' 35 assert_template 'previews/issue'
37 assert_not_nil assigns(:description) 36 assert_not_nil assigns(:description)
38 end 37 end
39 38
40 def test_preview_issue_notes 39 def test_preview_issue_notes
41 @request.session[:user_id] = 2 40 @request.session[:user_id] = 2
42 post :issue, :project_id => '1', :id => 1, 41 post :issue, :project_id => '1', :id => 1,
43 :issue => {:description => Issue.find(1).description, :notes => 'Foo'} 42 :issue => {:description => Issue.find(1).description, :notes => 'Foo'}
44 assert_response :success 43 assert_response :success
45 assert_template 'preview' 44 assert_template 'previews/issue'
46 assert_not_nil assigns(:notes) 45 assert_not_nil assigns(:notes)
47 end 46 end
48 47
49 def test_preview_journal_notes_for_update 48 def test_preview_journal_notes_for_update
50 @request.session[:user_id] = 2 49 @request.session[:user_id] = 2
51 post :issue, :project_id => '1', :id => 1, :notes => 'Foo' 50 post :issue, :project_id => '1', :id => 1, :notes => 'Foo'
52 assert_response :success 51 assert_response :success
53 assert_template 'preview' 52 assert_template 'previews/issue'
54 assert_not_nil assigns(:notes) 53 assert_not_nil assigns(:notes)
55 assert_tag :p, :content => 'Foo' 54 assert_tag :p, :content => 'Foo'
55 end
56
57 def test_preview_issue_notes_should_support_links_to_existing_attachments
58 Attachment.generate!(:container => Issue.find(1), :filename => 'foo.bar')
59 @request.session[:user_id] = 2
60 post :issue, :project_id => '1', :id => 1, :notes => 'attachment:foo.bar'
61 assert_response :success
62 assert_select 'a.attachment', :text => 'foo.bar'
56 end 63 end
57 64
58 def test_preview_new_news 65 def test_preview_new_news
59 get :news, :project_id => 1, 66 get :news, :project_id => 1,
60 :news => {:title => '', 67 :news => {:title => '',