comparison test/functional/issue_relations_controller_test.rb @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 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.
26 :issues, 26 :issues,
27 :issue_statuses, 27 :issue_statuses,
28 :issue_relations, 28 :issue_relations,
29 :enabled_modules, 29 :enabled_modules,
30 :enumerations, 30 :enumerations,
31 :trackers 31 :trackers,
32 :projects_trackers
32 33
33 def setup 34 def setup
34 User.current = nil 35 User.current = nil
35 @request.session[:user_id] = 3 36 @request.session[:user_id] = 3
36 end 37 end
85 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''} 86 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
86 end 87 end
87 end 88 end
88 end 89 end
89 90
91 def test_create_follows_relation_should_update_relations_list
92 issue1 = Issue.generate!(:subject => 'Followed issue', :start_date => Date.yesterday, :due_date => Date.today)
93 issue2 = Issue.generate!
94
95 assert_difference 'IssueRelation.count' do
96 xhr :post, :create, :issue_id => issue2.id,
97 :relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
98 end
99 assert_match /Followed issue/, response.body
100 end
101
90 def test_should_create_relations_with_visible_issues_only 102 def test_should_create_relations_with_visible_issues_only
91 Setting.cross_project_issue_relations = '1' 103 Setting.cross_project_issue_relations = '1'
92 assert_nil Issue.visible(User.find(3)).find_by_id(4) 104 assert_nil Issue.visible(User.find(3)).find_by_id(4)
93 105
94 assert_no_difference 'IssueRelation.count' do 106 assert_no_difference 'IssueRelation.count' do