##// END OF EJS Templates
remove trailing white-spaces from test/integration/api_test/versions_test.rb....
Toshi MARUYAMA -
r6570:4c7ae6da3999
parent child
Show More
@@ -5,12 +5,12
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 #
8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 #
13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -28,7 +28,7 class ApiTest::VersionsTest < ActionController::IntegrationTest
28 28 context "GET" do
29 29 should "return project versions" do
30 30 get '/projects/1/versions.xml'
31
31
32 32 assert_response :success
33 33 assert_equal 'application/xml', @response.content_type
34 34 assert_tag :tag => 'versions',
@@ -46,21 +46,21 class ApiTest::VersionsTest < ActionController::IntegrationTest
46 46 }
47 47 end
48 48 end
49
49
50 50 context "POST" do
51 51 should "create the version" do
52 52 assert_difference 'Version.count' do
53 53 post '/projects/1/versions.xml', {:version => {:name => 'API test'}}, :authorization => credentials('jsmith')
54 54 end
55
55
56 56 version = Version.first(:order => 'id DESC')
57 57 assert_equal 'API test', version.name
58
58
59 59 assert_response :created
60 60 assert_equal 'application/xml', @response.content_type
61 61 assert_tag 'version', :child => {:tag => 'id', :content => version.id.to_s}
62 62 end
63
63
64 64 context "with failure" do
65 65 should "return the errors" do
66 66 assert_no_difference('Version.count') do
@@ -73,15 +73,15 class ApiTest::VersionsTest < ActionController::IntegrationTest
73 73 end
74 74 end
75 75 end
76
76
77 77 context "/versions/:id" do
78 78 context "GET" do
79 79 should "return the version" do
80 80 get '/versions/2.xml'
81
81
82 82 assert_response :success
83 83 assert_equal 'application/xml', @response.content_type
84 assert_tag 'version',
84 assert_tag 'version',
85 85 :child => {
86 86 :tag => 'id',
87 87 :content => '2',
@@ -92,28 +92,28 class ApiTest::VersionsTest < ActionController::IntegrationTest
92 92 }
93 93 end
94 94 end
95
95
96 96 context "PUT" do
97 97 should "update the version" do
98 98 put '/versions/2.xml', {:version => {:name => 'API update'}}, :authorization => credentials('jsmith')
99
99
100 100 assert_response :ok
101 101 assert_equal 'API update', Version.find(2).name
102 102 end
103 103 end
104
104
105 105 context "DELETE" do
106 106 should "destroy the version" do
107 107 assert_difference 'Version.count', -1 do
108 108 delete '/versions/3.xml', {}, :authorization => credentials('jsmith')
109 109 end
110
110
111 111 assert_response :ok
112 112 assert_nil Version.find_by_id(3)
113 113 end
114 114 end
115 115 end
116
116
117 117 def credentials(user, password=nil)
118 118 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
119 119 end
General Comments 0
You need to be logged in to leave comments. Login now