##// END OF EJS Templates
remove trailing white-spaces from test/integration/api_test/time_entries_test.rb....
Toshi MARUYAMA -
r6814:ca7804bcb43c
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.
@@ -19,11 +19,11 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
20 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
21 fixtures :all
21 fixtures :all
22
22
23 def setup
23 def setup
24 Setting.rest_api_enabled = '1'
24 Setting.rest_api_enabled = '1'
25 end
25 end
26
26
27 context "GET /time_entries.xml" do
27 context "GET /time_entries.xml" do
28 should "return time entries" do
28 should "return time entries" do
29 get '/time_entries.xml', {}, :authorization => credentials('jsmith')
29 get '/time_entries.xml', {}, :authorization => credentials('jsmith')
@@ -32,7 +32,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
32 assert_tag :tag => 'time_entries',
32 assert_tag :tag => 'time_entries',
33 :child => {:tag => 'time_entry', :child => {:tag => 'id', :content => '2'}}
33 :child => {:tag => 'time_entry', :child => {:tag => 'id', :content => '2'}}
34 end
34 end
35
35
36 context "with limit" do
36 context "with limit" do
37 should "return limited results" do
37 should "return limited results" do
38 get '/time_entries.xml?limit=2', {}, :authorization => credentials('jsmith')
38 get '/time_entries.xml?limit=2', {}, :authorization => credentials('jsmith')
@@ -43,7 +43,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
43 end
43 end
44 end
44 end
45 end
45 end
46
46
47 context "GET /time_entries/2.xml" do
47 context "GET /time_entries/2.xml" do
48 should "return requested time entry" do
48 should "return requested time entry" do
49 get '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
49 get '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
@@ -53,7 +53,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
53 :child => {:tag => 'id', :content => '2'}
53 :child => {:tag => 'id', :content => '2'}
54 end
54 end
55 end
55 end
56
56
57 context "POST /time_entries.xml" do
57 context "POST /time_entries.xml" do
58 context "with issue_id" do
58 context "with issue_id" do
59 should "return create time entry" do
59 should "return create time entry" do
@@ -62,7 +62,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
62 end
62 end
63 assert_response :created
63 assert_response :created
64 assert_equal 'application/xml', @response.content_type
64 assert_equal 'application/xml', @response.content_type
65
65
66 entry = TimeEntry.first(:order => 'id DESC')
66 entry = TimeEntry.first(:order => 'id DESC')
67 assert_equal 'jsmith', entry.user.login
67 assert_equal 'jsmith', entry.user.login
68 assert_equal Issue.find(1), entry.issue
68 assert_equal Issue.find(1), entry.issue
@@ -72,7 +72,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
72 assert_equal TimeEntryActivity.find(11), entry.activity
72 assert_equal TimeEntryActivity.find(11), entry.activity
73 end
73 end
74 end
74 end
75
75
76 context "with project_id" do
76 context "with project_id" do
77 should "return create time entry" do
77 should "return create time entry" do
78 assert_difference 'TimeEntry.count' do
78 assert_difference 'TimeEntry.count' do
@@ -80,7 +80,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
80 end
80 end
81 assert_response :created
81 assert_response :created
82 assert_equal 'application/xml', @response.content_type
82 assert_equal 'application/xml', @response.content_type
83
83
84 entry = TimeEntry.first(:order => 'id DESC')
84 entry = TimeEntry.first(:order => 'id DESC')
85 assert_equal 'jsmith', entry.user.login
85 assert_equal 'jsmith', entry.user.login
86 assert_nil entry.issue
86 assert_nil entry.issue
@@ -90,7 +90,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
90 assert_equal TimeEntryActivity.find(11), entry.activity
90 assert_equal TimeEntryActivity.find(11), entry.activity
91 end
91 end
92 end
92 end
93
93
94 context "with invalid parameters" do
94 context "with invalid parameters" do
95 should "return errors" do
95 should "return errors" do
96 assert_no_difference 'TimeEntry.count' do
96 assert_no_difference 'TimeEntry.count' do
@@ -103,7 +103,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
103 end
103 end
104 end
104 end
105 end
105 end
106
106
107 context "PUT /time_entries/2.xml" do
107 context "PUT /time_entries/2.xml" do
108 context "with valid parameters" do
108 context "with valid parameters" do
109 should "update time entry" do
109 should "update time entry" do
@@ -127,7 +127,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
127 end
127 end
128 end
128 end
129 end
129 end
130
130
131 context "DELETE /time_entries/2.xml" do
131 context "DELETE /time_entries/2.xml" do
132 should "destroy time entry" do
132 should "destroy time entry" do
133 assert_difference 'TimeEntry.count', -1 do
133 assert_difference 'TimeEntry.count', -1 do
@@ -137,7 +137,7 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
137 assert_nil TimeEntry.find_by_id(2)
137 assert_nil TimeEntry.find_by_id(2)
138 end
138 end
139 end
139 end
140
140
141 def credentials(user, password=nil)
141 def credentials(user, password=nil)
142 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
142 ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user)
143 end
143 end
General Comments 0
You need to be logged in to leave comments. Login now