##// END OF EJS Templates
remove trailing white-spaces from test/integration/api_test/news_test.rb....
Toshi MARUYAMA -
r6553:50f7af6b9339
parent child
Show More
@@ -1,16 +1,16
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2010 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 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.
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,7 +28,7 class ApiTest::NewsTest < ActionController::IntegrationTest
28 context ".xml" do
28 context ".xml" do
29 should "return news" do
29 should "return news" do
30 get '/news.xml'
30 get '/news.xml'
31
31
32 assert_tag :tag => 'news',
32 assert_tag :tag => 'news',
33 :attributes => {:type => 'array'},
33 :attributes => {:type => 'array'},
34 :child => {
34 :child => {
@@ -40,11 +40,11 class ApiTest::NewsTest < ActionController::IntegrationTest
40 }
40 }
41 end
41 end
42 end
42 end
43
43
44 context ".json" do
44 context ".json" do
45 should "return news" do
45 should "return news" do
46 get '/news.json'
46 get '/news.json'
47
47
48 json = ActiveSupport::JSON.decode(response.body)
48 json = ActiveSupport::JSON.decode(response.body)
49 assert_kind_of Hash, json
49 assert_kind_of Hash, json
50 assert_kind_of Array, json['news']
50 assert_kind_of Array, json['news']
@@ -57,10 +57,10 class ApiTest::NewsTest < ActionController::IntegrationTest
57 context "GET /projects/:project_id/news" do
57 context "GET /projects/:project_id/news" do
58 context ".xml" do
58 context ".xml" do
59 should_allow_api_authentication(:get, "/projects/onlinestore/news.xml")
59 should_allow_api_authentication(:get, "/projects/onlinestore/news.xml")
60
60
61 should "return news" do
61 should "return news" do
62 get '/projects/ecookbook/news.xml'
62 get '/projects/ecookbook/news.xml'
63
63
64 assert_tag :tag => 'news',
64 assert_tag :tag => 'news',
65 :attributes => {:type => 'array'},
65 :attributes => {:type => 'array'},
66 :child => {
66 :child => {
@@ -72,13 +72,13 class ApiTest::NewsTest < ActionController::IntegrationTest
72 }
72 }
73 end
73 end
74 end
74 end
75
75
76 context ".json" do
76 context ".json" do
77 should_allow_api_authentication(:get, "/projects/onlinestore/news.json")
77 should_allow_api_authentication(:get, "/projects/onlinestore/news.json")
78
78
79 should "return news" do
79 should "return news" do
80 get '/projects/ecookbook/news.json'
80 get '/projects/ecookbook/news.json'
81
81
82 json = ActiveSupport::JSON.decode(response.body)
82 json = ActiveSupport::JSON.decode(response.body)
83 assert_kind_of Hash, json
83 assert_kind_of Hash, json
84 assert_kind_of Array, json['news']
84 assert_kind_of Array, json['news']
@@ -87,7 +87,7 class ApiTest::NewsTest < ActionController::IntegrationTest
87 end
87 end
88 end
88 end
89 end
89 end
90
90
91 def credentials(user, password=nil)
91 def credentials(user, password=nil)
92 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
92 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
93 end
93 end
General Comments 0
You need to be logged in to leave comments. Login now