Mercurial > hg > soundsoftware-site
comparison test/functional/.svn/text-base/issue_relations_controller_test.rb.svn-base @ 210:0579821a129a
Update to Redmine trunk rev 4802
author | Chris Cannam |
---|---|
date | Tue, 08 Feb 2011 13:51:46 +0000 |
parents | 8661b858af72 |
children | 0c939c159af4 |
comparison
equal
deleted
inserted
replaced
128:07fa8a8b56a8 | 210:0579821a129a |
---|---|
28 def test_new | 28 def test_new |
29 assert_difference 'IssueRelation.count' do | 29 assert_difference 'IssueRelation.count' do |
30 @request.session[:user_id] = 3 | 30 @request.session[:user_id] = 3 |
31 post :new, :issue_id => 1, | 31 post :new, :issue_id => 1, |
32 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''} | 32 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''} |
33 end | |
34 end | |
35 | |
36 def test_new_xhr | |
37 assert_difference 'IssueRelation.count' do | |
38 @request.session[:user_id] = 3 | |
39 xhr :post, :new, | |
40 :issue_id => 3, | |
41 :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''} | |
42 assert_select_rjs 'relations' do | |
43 assert_select 'table', 1 | |
44 assert_select 'tr', 2 # relations | |
45 end | |
33 end | 46 end |
34 end | 47 end |
35 | 48 |
36 def test_new_should_accept_id_with_hash | 49 def test_new_should_accept_id_with_hash |
37 assert_difference 'IssueRelation.count' do | 50 assert_difference 'IssueRelation.count' do |
66 assert_difference 'IssueRelation.count', -1 do | 79 assert_difference 'IssueRelation.count', -1 do |
67 @request.session[:user_id] = 3 | 80 @request.session[:user_id] = 3 |
68 post :destroy, :id => '2', :issue_id => '3' | 81 post :destroy, :id => '2', :issue_id => '3' |
69 end | 82 end |
70 end | 83 end |
84 | |
85 def test_destroy_xhr | |
86 IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r| | |
87 r.issue_from_id = 3 | |
88 r.issue_to_id = 1 | |
89 end | |
90 | |
91 assert_difference 'IssueRelation.count', -1 do | |
92 @request.session[:user_id] = 3 | |
93 xhr :post, :destroy, :id => '2', :issue_id => '3' | |
94 assert_select_rjs 'relations' do | |
95 assert_select 'table', 1 | |
96 assert_select 'tr', 1 # relation left | |
97 end | |
98 end | |
99 end | |
71 end | 100 end |