Test cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8477 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-01-02 19:59:52 +00:00
parent 395fe0d777
commit 131f258f5f
10 changed files with 79 additions and 85 deletions
@@ -34,7 +34,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "GET /time_entries.xml" do
should "return time entries" do
get '/time_entries.xml', {}, :authorization => credentials('jsmith')
get '/time_entries.xml', {}, credentials('jsmith')
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag :tag => 'time_entries',
@@ -43,7 +43,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with limit" do
should "return limited results" do
get '/time_entries.xml?limit=2', {}, :authorization => credentials('jsmith')
get '/time_entries.xml?limit=2', {}, credentials('jsmith')
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag :tag => 'time_entries',
@@ -54,7 +54,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "GET /time_entries/2.xml" do
should "return requested time entry" do
get '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
get '/time_entries/2.xml', {}, credentials('jsmith')
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag :tag => 'time_entry',
@@ -66,7 +66,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with issue_id" do
should "return create time entry" do
assert_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :created
assert_equal 'application/xml', @response.content_type
@@ -84,7 +84,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with project_id" do
should "return create time entry" do
assert_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :created
assert_equal 'application/xml', @response.content_type
@@ -102,7 +102,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with invalid parameters" do
should "return errors" do
assert_no_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :unprocessable_entity
assert_equal 'application/xml', @response.content_type
@@ -116,7 +116,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with valid parameters" do
should "update time entry" do
assert_no_difference 'TimeEntry.count' do
put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, :authorization => credentials('jsmith')
put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, credentials('jsmith')
end
assert_response :ok
assert_equal 'API Update', TimeEntry.find(2).comments
@@ -126,7 +126,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with invalid parameters" do
should "return errors" do
assert_no_difference 'TimeEntry.count' do
put '/time_entries/2.xml', {:time_entry => {:hours => '', :comments => 'API Update'}}, :authorization => credentials('jsmith')
put '/time_entries/2.xml', {:time_entry => {:hours => '', :comments => 'API Update'}}, credentials('jsmith')
end
assert_response :unprocessable_entity
assert_equal 'application/xml', @response.content_type
@@ -139,7 +139,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "DELETE /time_entries/2.xml" do
should "destroy time entry" do
assert_difference 'TimeEntry.count', -1 do
delete '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
delete '/time_entries/2.xml', {}, credentials('jsmith')
end
assert_response :ok
assert_nil TimeEntry.find_by_id(2)