Mercurial > hg > soundsoftware-site
diff test/integration/api_test/issue_relations_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/test/integration/api_test/issue_relations_test.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/test/integration/api_test/issue_relations_test.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -35,7 +35,7 @@ context "/issues/:issue_id/relations" do context "GET" do should "return issue relations" do - get '/issues/9/relations.xml', {}, :authorization => credentials('jsmith') + get '/issues/9/relations.xml', {}, credentials('jsmith') assert_response :success assert_equal 'application/xml', @response.content_type @@ -55,7 +55,7 @@ context "POST" do should "create a relation" do assert_difference('IssueRelation.count') do - post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, :authorization => credentials('jsmith') + post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'relates'}}, credentials('jsmith') end relation = IssueRelation.first(:order => 'id DESC') @@ -71,11 +71,11 @@ context "with failure" do should "return the errors" do assert_no_difference('IssueRelation.count') do - post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, :authorization => credentials('jsmith') + post '/issues/2/relations.xml', {:relation => {:issue_to_id => 7, :relation_type => 'foo'}}, credentials('jsmith') end assert_response :unprocessable_entity - assert_tag :errors, :child => {:tag => 'error', :content => 'relation_type is not included in the list'} + assert_tag :errors, :child => {:tag => 'error', :content => /relation_type is not included in the list/} end end end @@ -84,7 +84,7 @@ context "/relations/:id" do context "GET" do should "return the relation" do - get '/relations/2.xml', {}, :authorization => credentials('jsmith') + get '/relations/2.xml', {}, credentials('jsmith') assert_response :success assert_equal 'application/xml', @response.content_type @@ -95,16 +95,13 @@ context "DELETE" do should "delete the relation" do assert_difference('IssueRelation.count', -1) do - delete '/relations/2.xml', {}, :authorization => credentials('jsmith') + delete '/relations/2.xml', {}, credentials('jsmith') end assert_response :ok + assert_equal '', @response.body assert_nil IssueRelation.find_by_id(2) end end end - - def credentials(user, password=nil) - ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) - end end