##// END OF EJS Templates
remove trailing white-spaces from test/integration/api_test/issue_relations_test.rb....
Toshi MARUYAMA -
r6811:e103d11178e5
parent child
Show More
@@ -5,12 +5,12
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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -28,10 +28,10 class ApiTest::IssueRelationsTest < ActionController::IntegrationTest
28 context "GET" do
28 context "GET" do
29 should "return issue relations" do
29 should "return issue relations" do
30 get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith')
30 get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith')
31
31
32 assert_response :success
32 assert_response :success
33 assert_equal 'application/xml', @response.content_type
33 assert_equal 'application/xml', @response.content_type
34
34
35 assert_tag :tag => 'relations',
35 assert_tag :tag => 'relations',
36 :attributes => { :type => 'array' },
36 :attributes => { :type => 'array' },
37 :child => {
37 :child => {
@@ -43,23 +43,23 class ApiTest::IssueRelationsTest < ActionController::IntegrationTest
43 }
43 }
44 end
44 end
45 end
45 end
46
46
47 context "POST" do
47 context "POST" do
48 should "create a relation" do
48 should "create a relation" do
49 assert_difference('IssueRelation.count') do
49 assert_difference('IssueRelation.count') do
50 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith')
50 post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith')
51 end
51 end
52
52
53 relation = IssueRelation.first(:order => 'id DESC')
53 relation = IssueRelation.first(:order => 'id DESC')
54 assert_equal 2, relation.issue_from_id
54 assert_equal 2, relation.issue_from_id
55 assert_equal 7, relation.issue_to_id
55 assert_equal 7, relation.issue_to_id
56 assert_equal 'relates', relation.relation_type
56 assert_equal 'relates', relation.relation_type
57
57
58 assert_response :created
58 assert_response :created
59 assert_equal 'application/xml', @response.content_type
59 assert_equal 'application/xml', @response.content_type
60 assert_tag 'relation', :child => {:tag => 'id', :content => relation.id.to_s}
60 assert_tag 'relation', :child => {:tag => 'id', :content => relation.id.to_s}
61 end
61 end
62
62
63 context "with failure" do
63 context "with failure" do
64 should "return the errors" do
64 should "return the errors" do
65 assert_no_difference('IssueRelation.count') do
65 assert_no_difference('IssueRelation.count') do
@@ -72,24 +72,24 class ApiTest::IssueRelationsTest < ActionController::IntegrationTest
72 end
72 end
73 end
73 end
74 end
74 end
75
75
76 context "/relations/:id" do
76 context "/relations/:id" do
77 context "GET" do
77 context "GET" do
78 should "return the relation" do
78 should "return the relation" do
79 get '/relations/2.xml', {}, :authorization => credentials('jsmith')
79 get '/relations/2.xml', {}, :authorization => credentials('jsmith')
80
80
81 assert_response :success
81 assert_response :success
82 assert_equal 'application/xml', @response.content_type
82 assert_equal 'application/xml', @response.content_type
83 assert_tag 'relation', :child => {:tag => 'id', :content => '2'}
83 assert_tag 'relation', :child => {:tag => 'id', :content => '2'}
84 end
84 end
85 end
85 end
86
86
87 context "DELETE" do
87 context "DELETE" do
88 should "delete the relation" do
88 should "delete the relation" do
89 assert_difference('IssueRelation.count', -1) do
89 assert_difference('IssueRelation.count', -1) do
90 delete '/relations/2.xml', {}, :authorization => credentials('jsmith')
90 delete '/relations/2.xml', {}, :authorization => credentials('jsmith')
91 end
91 end
92
92
93 assert_response :ok
93 assert_response :ok
94 assert_nil IssueRelation.find_by_id(2)
94 assert_nil IssueRelation.find_by_id(2)
95 end
95 end
General Comments 0
You need to be logged in to leave comments. Login now