diff options
author | Go MAEDA <maeda@farend.jp> | 2020-01-27 03:54:25 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-01-27 03:54:25 +0000 |
commit | f37ed7766572550bd563632f69ad940717fa9b90 (patch) | |
tree | 6ca7069360504e61396f2c95d458853ff4c8fa39 | |
parent | d168df5c822f305cb510d072144c39f205b1bd3d (diff) | |
download | redmine-f37ed7766572550bd563632f69ad940717fa9b90.tar.gz redmine-f37ed7766572550bd563632f69ad940717fa9b90.zip |
Use #media_type instead of #content_type to test the MIME type of a response (#32886).
Patch by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@19467 e93f8b46-1217-0410-a6f0-8f06a7374b81
44 files changed, 223 insertions, 223 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index b0cb09251..a3442f6a3 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -45,7 +45,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest ) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ assert_select 'td.line-code', :text => /Demande créée avec succès/ end @@ -64,7 +64,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest ) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'th.filename', :text => /issues_controller.rb\t\(r\?vision 1484\)/ assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/ end @@ -84,7 +84,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest ) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ assert_select 'td.line-code', :text => /Demande créée avec succès/ end @@ -136,14 +136,14 @@ class AttachmentsControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'th.filename', :text => 'test1.txt' end def test_show_text_file get(:show, :params => {:id => 4}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type end def test_show_text_file_utf_8 @@ -155,7 +155,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_equal 'japanese-utf-8.txt', a.filename get(:show, :params => {:id => a.id}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'tr#L1' do assert_select 'th.line-num', :text => '1' assert_select 'td', :text => /日本語/ @@ -172,7 +172,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_equal 'iso8859-1.txt', a.filename get(:show, :params => {:id => a.id}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'tr#L7' do assert_select 'th.line-num', :text => '7' assert_select 'td', :text => /Demande cr\?\?e avec succ\?s/ @@ -190,7 +190,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_equal 'iso8859-1.txt', a.filename get(:show, :params => {:id => a.id}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'tr#L7' do assert_select 'th.line-num', :text => '7' assert_select 'td', :text => /Demande créée avec succès/ @@ -204,7 +204,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest Attachment.find(4).update_attribute :filesize, 754.kilobyte get(:show, :params => {:id => 4}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select '.nodata', :text => 'No preview available. Download the file instead.' end end @@ -218,7 +218,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_equal 'testfile.md', a.filename get(:show, :params => {:id => a.id}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>" end @@ -231,7 +231,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_equal 'testfile.textile', a.filename get(:show, :params => {:id => a.id}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n\n\t<h2>Header 2</h2>\n\n\n\t<h3>Header 3</h3>" end @@ -239,14 +239,14 @@ class AttachmentsControllerTest < Redmine::ControllerTest @request.session[:user_id] = 2 get(:show, :params => {:id => 16}) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'img.filecontent', :src => attachments(:attachments_010).filename end def test_show_other_with_no_preview @request.session[:user_id] = 2 get(:show, :params => {:id => 6}) - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select '.nodata', :text => 'No preview available. Download the file instead.' end @@ -301,7 +301,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest def test_download_text_file get(:download, :params => {:id => 4}) assert_response :success - assert_equal 'application/x-ruby', @response.content_type + assert_equal 'application/x-ruby', @response.media_type etag = @response.etag assert_not_nil etag @@ -320,7 +320,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest get(:download, :params => {:id => attachment.id}) assert_response :success - assert_equal 'text/javascript', @response.content_type + assert_equal 'text/javascript', @response.media_type end def test_download_version_file_with_issue_tracking_disabled @@ -333,21 +333,21 @@ class AttachmentsControllerTest < Redmine::ControllerTest Attachment.find(4).update_attribute(:content_type, '') get(:download, :params => {:id => 4}) assert_response :success - assert_equal 'text/x-ruby', @response.content_type + assert_equal 'text/x-ruby', @response.media_type end def test_download_should_assign_better_content_type_than_application_octet_stream Attachment.find(4).update! :content_type => "application/octet-stream" get(:download, :params => {:id => 4}) assert_response :success - assert_equal 'text/x-ruby', @response.content_type + assert_equal 'text/x-ruby', @response.media_type end def test_download_should_assign_application_octet_stream_if_content_type_is_not_determined get(:download, :params => {:id => 22}) assert_response :success assert_nil Redmine::MimeType.of(attachments(:attachments_022).filename) - assert_equal 'application/octet-stream', @response.content_type + assert_equal 'application/octet-stream', @response.media_type end def test_download_missing_file @@ -371,7 +371,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'image/png', response.content_type + assert_equal 'image/png', response.media_type etag = @response.etag assert_not_nil etag @@ -459,7 +459,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'image/png', response.content_type + assert_equal 'image/png', response.media_type end else puts '(GhostScript convert not available)' diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb index 6337640e7..f01f62f9d 100644 --- a/test/functional/auth_sources_controller_test.rb +++ b/test/functional/auth_sources_controller_test.rb @@ -197,7 +197,7 @@ class AuthSourcesControllerTest < Redmine::ControllerTest :term => 'foo' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Array, json assert_equal 2, json.size diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index 7f41888ff..07229d441 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -263,7 +263,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include '<option selected=\"selected\" value=\"list\">List<\/option>', response.body end diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb index 2042ecf88..606d5765e 100644 --- a/test/functional/gantts_controller_test.rb +++ b/test/functional/gantts_controller_test.rb @@ -142,7 +142,7 @@ class GanttsControllerTest < Redmine::ControllerTest :format => 'pdf' } assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -151,7 +151,7 @@ class GanttsControllerTest < Redmine::ControllerTest :format => 'pdf' } assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -162,7 +162,7 @@ class GanttsControllerTest < Redmine::ControllerTest :format => 'png' } assert_response :success - assert_equal 'image/png', @response.content_type + assert_equal 'image/png', @response.media_type end end diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb index 091a31b5c..7f5033aa1 100644 --- a/test/functional/groups_controller_test.rb +++ b/test/functional/groups_controller_test.rb @@ -191,7 +191,7 @@ class GroupsControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_add_users @@ -217,7 +217,7 @@ class GroupsControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_match /John Smith/, response.body end @@ -245,7 +245,7 @@ class GroupsControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end end diff --git a/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb index 478241608..d947f1557 100644 --- a/test/functional/issue_categories_controller_test.rb +++ b/test/functional/issue_categories_controller_test.rb @@ -45,7 +45,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create @@ -100,7 +100,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest assert_equal 'New category', category.name assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create_from_issue_form_with_failure @@ -119,7 +119,7 @@ class IssueCategoriesControllerTest < Redmine::ControllerTest end assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'Name cannot be blank', response.body end diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb index 45e87cbc1..f0395c9b8 100644 --- a/test/functional/issue_relations_controller_test.rb +++ b/test/functional/issue_relations_controller_test.rb @@ -81,7 +81,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end relation = IssueRelation.order('id DESC').first assert_equal 1, relation.issue_from_id @@ -182,7 +182,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_include 'Related issue cannot be blank', response.body end @@ -217,7 +217,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'relation-2', response.body end end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 9c793fdeb..11d93cf21 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -463,7 +463,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', response.content_type + assert_equal 'application/pdf', response.media_type end def test_index_with_query_grouped_by_list_custom_field @@ -1081,7 +1081,7 @@ class IssuesControllerTest < Redmine::ControllerTest get(:index, :params => {:format => 'pdf'}) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type get( :index, @@ -1091,7 +1091,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type get( :index, @@ -1102,7 +1102,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type end end end @@ -1117,7 +1117,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type end def test_index_atom @@ -1129,7 +1129,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/atom+xml', response.content_type + assert_equal 'application/atom+xml', response.media_type assert_select 'feed' do assert_select 'link[rel=self][href=?]', 'http://test.host/projects/ecookbook/issues.atom' @@ -1612,7 +1612,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', response.content_type + assert_equal 'application/pdf', response.media_type end def test_index_with_description_column @@ -1635,7 +1635,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', response.content_type + assert_equal 'application/pdf', response.media_type end def test_index_with_last_notes_column @@ -1663,7 +1663,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', response.content_type + assert_equal 'application/pdf', response.media_type end def test_index_with_last_notes_column_should_display_private_notes_with_permission_only @@ -1887,7 +1887,7 @@ class IssuesControllerTest < Redmine::ControllerTest } } ) - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select_error /Start date cannot be blank/i end @@ -1902,7 +1902,7 @@ class IssuesControllerTest < Redmine::ControllerTest :format => 'csv' } ) - assert_equal 'text/csv', @response.content_type + assert_equal 'text/csv', @response.media_type assert @response.body.blank? end @@ -2649,7 +2649,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/atom+xml', response.content_type + assert_equal 'application/atom+xml', response.media_type # Inline image assert_select( 'content', @@ -2668,7 +2668,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -2684,7 +2684,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end end @@ -2702,7 +2702,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -2721,7 +2721,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -2734,7 +2734,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -2754,7 +2754,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end @@ -2773,7 +2773,7 @@ class IssuesControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert @response.body.starts_with?('%PDF') end end @@ -3526,7 +3526,7 @@ class IssuesControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'This is the test_new issue', response.body end @@ -5343,7 +5343,7 @@ class IssuesControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'This is the test_new issue', response.body end diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index 929c2a1d0..6938e8c0e 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -34,7 +34,7 @@ class JournalsControllerTest < Redmine::ControllerTest :project_id => 1 } assert_response :success - assert_equal 'application/atom+xml', @response.content_type + assert_equal 'application/atom+xml', @response.media_type end def test_index_with_invalid_query_id @@ -166,7 +166,7 @@ class JournalsControllerTest < Redmine::ControllerTest :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include '> This is an issue', response.body end @@ -188,7 +188,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'Redmine Admin wrote in #note-1:', response.body assert_include '> A comment with a private version', response.body end @@ -203,7 +203,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include '> Privates notes', response.body Role.find(1).remove_permission! :view_private_notes @@ -222,7 +222,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'textarea', response.body end @@ -236,7 +236,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'textarea', response.body Role.find(1).remove_permission! :view_private_notes @@ -257,7 +257,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_equal 'Updated notes', Journal.find(2).notes assert_include 'journal-2-notes', response.body # response should include journal_indice param for quote link @@ -274,7 +274,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_equal true, Journal.find(2).private_notes assert_include 'change-2', response.body assert_include 'journal-2-private_notes', response.body @@ -291,7 +291,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_equal false, Journal.find(2).private_notes assert_include 'change-2', response.body assert_include 'journal-2-private_notes', response.body @@ -325,7 +325,7 @@ class JournalsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_nil Journal.find_by_id(2) assert_include 'change-2', response.body diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb index 9bd7dc605..4d53bedcd 100644 --- a/test/functional/members_controller_test.rb +++ b/test/functional/members_controller_test.rb @@ -56,7 +56,7 @@ class MembersControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create @@ -133,7 +133,7 @@ class MembersControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert User.find(7).member_of?(Project.find(1)) assert User.find(8).member_of?(Project.find(1)) @@ -152,7 +152,7 @@ class MembersControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_match /alert/, response.body, "Alert message not sent" end @@ -242,7 +242,7 @@ class MembersControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end member = Member.find(2) assert_equal [1], member.role_ids @@ -303,7 +303,7 @@ class MembersControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_nil Member.find_by_id(2) assert_include 'tab-content-members', response.body diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index ad193b119..46e2c6c61 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.rb @@ -266,7 +266,7 @@ class MessagesControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'RE: First post', response.body assert_include "Redmine Admin wrote:", response.body @@ -281,7 +281,7 @@ class MessagesControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'RE: First post', response.body assert_include 'John Smith wrote in message#3:', response.body diff --git a/test/functional/principal_memberships_controller_test.rb b/test/functional/principal_memberships_controller_test.rb index 974abc1c4..5dc795867 100644 --- a/test/functional/principal_memberships_controller_test.rb +++ b/test/functional/principal_memberships_controller_test.rb @@ -54,7 +54,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create_user_membership @@ -121,7 +121,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end member = Member.order('id DESC').first assert_equal User.find(7), member.principal @@ -141,7 +141,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_include 'alert', response.body, "Alert message not sent" assert_include 'Role cannot be empty', response.body, "Error message not sent" @@ -191,7 +191,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_equal [2], Member.find(1).role_ids assert_include '$("#member-1-roles").html("Developer").show();', response.body @@ -216,7 +216,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_nil Member.find_by_id(1) assert_include 'tab-content-memberships', response.body @@ -228,7 +228,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create_group_membership @@ -254,7 +254,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_match /OnlineStore/, response.body end @@ -270,7 +270,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_match /alert/, response.body, "Alert message not sent" end @@ -298,7 +298,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end end @@ -319,7 +319,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest }, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end end end diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 89bfacee6..786bcebba 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -240,7 +240,7 @@ class ProjectsControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_autocomplete_js_with_blank_search_term @@ -253,7 +253,7 @@ class ProjectsControllerTest < Redmine::ControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end test "#index by non-admin user with view_time_entries permission should show overall spent time link" do diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 2db4ac7d6..39e4a20b7 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -706,7 +706,7 @@ class QueriesControllerTest < Redmine::ControllerTest } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_include ["eCookbook - 2.0", "3", "open"], json end @@ -720,7 +720,7 @@ class QueriesControllerTest < Redmine::ControllerTest } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_include ["eCookbook - 2.0", "3", "open"], json end @@ -735,7 +735,7 @@ class QueriesControllerTest < Redmine::ControllerTest } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) # response includes visible version @@ -756,7 +756,7 @@ class QueriesControllerTest < Redmine::ControllerTest } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 4, json.count assert_include ["Private child of eCookbook","5"], json @@ -770,7 +770,7 @@ class QueriesControllerTest < Redmine::ControllerTest :name => 'assigned_to_id' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 6, json.count @@ -788,7 +788,7 @@ class QueriesControllerTest < Redmine::ControllerTest :name => 'author_id' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 7, json.count @@ -807,7 +807,7 @@ class QueriesControllerTest < Redmine::ControllerTest :name => 'user_id' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 7, json.count @@ -827,7 +827,7 @@ class QueriesControllerTest < Redmine::ControllerTest :name => 'watcher_id' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 1, json.count @@ -844,7 +844,7 @@ class QueriesControllerTest < Redmine::ControllerTest :name => 'watcher_id' } assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 6, json.count diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb index 846eb84e0..cca1d99a4 100644 --- a/test/functional/repositories_controller_test.rb +++ b/test/functional/repositories_controller_test.rb @@ -331,7 +331,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_equal [2], Changeset.find(103).issue_ids assert_include 'related-issues', response.body @@ -371,7 +371,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_include 'alert("Issue is invalid")', response.body end @@ -393,7 +393,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest :xhr => true ) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end assert_equal [1], Changeset.find(103).issue_ids assert_include 'related-issue-2', response.body @@ -413,7 +413,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest } ) assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type data = ActiveSupport::JSON.decode(response.body) assert_not_nil data['labels'] assert_not_nil data['commits'] @@ -430,7 +430,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest } ) assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type data = ActiveSupport::JSON.decode(response.body) assert_not_nil data['labels'] assert_not_nil data['commits'] diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb index f502ab8d2..4fe719016 100644 --- a/test/functional/repositories_filesystem_controller_test.rb +++ b/test/functional/repositories_filesystem_controller_test.rb @@ -95,7 +95,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest :path => repository_path_hash(['test'])[:param] } assert_response :success - assert_equal 'application/octet-stream', @response.content_type + assert_equal 'application/octet-stream', @response.media_type end def test_show_non_ascii_contents @@ -138,7 +138,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest :path => repository_path_hash(['japanese', 'big-file.txt'])[:param] } assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'p.nodata' end end diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 027e21fad..30fcf2064 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -249,7 +249,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest } ) assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_select 'p.nodata' end end @@ -470,7 +470,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest } ) assert_response :success - assert_equal 'text/x-patch', @response.content_type + assert_equal 'text/x-patch', @response.media_type assert_equal 'Index: subversion_test/folder/greeter.rb', @response.body.split(/\r?\n/).first end diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb index 3afdffb21..352903c9a 100644 --- a/test/functional/sys_controller_test.rb +++ b/test/functional/sys_controller_test.rb @@ -34,7 +34,7 @@ class SysControllerTest < Redmine::ControllerTest def test_projects_with_repository_enabled get :projects assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type data = ActiveSupport::JSON.decode(response.body) @@ -56,7 +56,7 @@ class SysControllerTest < Redmine::ControllerTest :repository => { :url => 'file:///create/project/repository/subproject2'} } assert_response :created - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type r = Project.find(4).repository assert r.is_a?(Repository::Subversion) diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 6c69f6f9f..3c14e8e7b 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -1341,7 +1341,7 @@ class TimelogControllerTest < Redmine::ControllerTest def test_index_atom_feed get :index, :params => {:project_id => 1, :format => 'atom'} assert_response :success - assert_equal 'application/atom+xml', @response.content_type + assert_equal 'application/atom+xml', @response.media_type assert_select 'entry > title', :text => /7\.65 hours/ end diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index 44c683d7a..b298153bc 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -228,7 +228,7 @@ class VersionsControllerTest < Redmine::ControllerTest @request.session[:user_id] = 2 get :new, :params => {:project_id => '1'}, :xhr => true assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_create @@ -252,7 +252,7 @@ class VersionsControllerTest < Redmine::ControllerTest assert_equal 1, version.project_id assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type assert_include 'test_add_version_from_issue_form', response.body end @@ -262,7 +262,7 @@ class VersionsControllerTest < Redmine::ControllerTest post :create, :params => {:project_id => '1', :version => {:name => ''}}, :xhr => true end assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end def test_get_edit diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index bb76f51e8..219d13317 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -1009,7 +1009,7 @@ class WikiControllerTest < Redmine::ControllerTest get :export, :params => {:project_id => 'ecookbook'} assert_response :success - assert_equal "text/html", @response.content_type + assert_equal "text/html", @response.media_type assert_select "a[name=?]", "CookBook_documentation" assert_select "a[name=?]", "Another_page" @@ -1021,7 +1021,7 @@ class WikiControllerTest < Redmine::ControllerTest get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'} assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition'] assert @response.body.starts_with?('%PDF') end @@ -1086,7 +1086,7 @@ class WikiControllerTest < Redmine::ControllerTest get :show, :params => {:project_id => 1, :format => 'pdf'} assert_response :success - assert_equal 'application/pdf', @response.content_type + assert_equal 'application/pdf', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.pdf"', @response.headers['Content-Disposition'] end @@ -1096,7 +1096,7 @@ class WikiControllerTest < Redmine::ControllerTest get :show, :params => {:project_id => 1, :format => 'html'} assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.html"', @response.headers['Content-Disposition'] assert_select 'h1', :text => /CookBook documentation/ @@ -1107,7 +1107,7 @@ class WikiControllerTest < Redmine::ControllerTest get :show, :params => {:project_id => 1, :format => 'html', :version => 2} assert_response :success - assert_equal 'text/html', @response.content_type + assert_equal 'text/html', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.html"', @response.headers['Content-Disposition'] assert_select 'h1', :text => /CookBook documentation v2/ @@ -1118,7 +1118,7 @@ class WikiControllerTest < Redmine::ControllerTest get :show, :params => {:project_id => 1, :format => 'txt'} assert_response :success - assert_equal 'text/plain', @response.content_type + assert_equal 'text/plain', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.txt"', @response.headers['Content-Disposition'] assert_include 'h1. CookBook documentation', @response.body @@ -1129,7 +1129,7 @@ class WikiControllerTest < Redmine::ControllerTest get :show, :params => {:project_id => 1, :format => 'txt', :version => 2} assert_response :success - assert_equal 'text/plain', @response.content_type + assert_equal 'text/plain', @response.media_type assert_equal 'attachment; filename="CookBook_documentation.txt"', @response.headers['Content-Disposition'] assert_include 'h1. CookBook documentation v2', @response.body diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index f63c2b057..4a58ccfc0 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -42,7 +42,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/:id.xml should return the attachment" do get '/attachments/7.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'attachment id', :text => '7' do assert_select '~ filename', :text => 'archive.zip' assert_select '~ content_url', :text => 'http://www.example.com/attachments/download/7/archive.zip' @@ -52,7 +52,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/:id.xml for image should include thumbnail_url" do get '/attachments/16.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'attachment id:contains(16)' do assert_select '~ thumbnail_url', :text => 'http://www.example.com/attachments/thumbnail/16' end @@ -66,7 +66,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base test "GET /attachments/download/:id/:filename should return the attachment content" do get '/attachments/download/7/archive.zip', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/zip', @response.content_type + assert_equal 'application/zip', @response.media_type end test "GET /attachments/download/:id/:filename should deny access without credentials" do @@ -104,7 +104,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :no_content - assert_nil response.content_type + assert_nil response.media_type attachment = Attachment.find(7) assert_equal 'renamed.zip', attachment.filename assert_equal 'updated', attachment.description @@ -116,7 +116,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response 422 - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_include "File cannot be blank", json['errors'] end @@ -129,7 +129,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base "CONTENT_TYPE" => 'application/octet-stream' }.merge(credentials('jsmith')) assert_response :created - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end xml = Hash.from_xml(response.body) @@ -160,7 +160,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base "CONTENT_TYPE" => 'application/octet-stream' }.merge(credentials('jsmith')) assert_response :created - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type end json = ActiveSupport::JSON.decode(response.body) diff --git a/test/integration/api_test/custom_fields_test.rb b/test/integration/api_test/custom_fields_test.rb index acdea3949..cf66f2158 100644 --- a/test/integration/api_test/custom_fields_test.rb +++ b/test/integration/api_test/custom_fields_test.rb @@ -25,7 +25,7 @@ class Redmine::ApiTest::CustomFieldsTest < Redmine::ApiTest::Base test "GET /custom_fields.xml should return custom fields" do get '/custom_fields.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'custom_fields' do assert_select 'custom_field' do diff --git a/test/integration/api_test/enumerations_test.rb b/test/integration/api_test/enumerations_test.rb index 05e0e9f7c..a639d38c9 100644 --- a/test/integration/api_test/enumerations_test.rb +++ b/test/integration/api_test/enumerations_test.rb @@ -25,7 +25,7 @@ class Redmine::ApiTest::EnumerationsTest < Redmine::ApiTest::Base test "GET /enumerations/issue_priorities.xml should return priorities" do get '/enumerations/issue_priorities.xml' assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue_priorities[type=array]' do assert_select 'issue_priority:nth-of-type(3)' do assert_select 'id', :text => '6' @@ -43,6 +43,6 @@ class Redmine::ApiTest::EnumerationsTest < Redmine::ApiTest::Base test "GET /enumerations/invalid_subclass.xml should return 404" do get '/enumerations/invalid_subclass.xml' assert_response 404 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end end diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb index 4f3284c1e..bd17a03ca 100644 --- a/test/integration/api_test/groups_test.rb +++ b/test/integration/api_test/groups_test.rb @@ -30,7 +30,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.xml should return givable groups" do get '/groups.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'groups' do assert_select 'group', Group.givable.count @@ -44,7 +44,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.xml?builtin=1 should return all groups" do get '/groups.xml?builtin=1', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'groups' do assert_select 'group', Group.givable.count + 2 @@ -67,7 +67,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups.json should return groups" do get '/groups.json', :headers => credentials('admin') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) groups = json['groups'] @@ -80,7 +80,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should return the group" do get '/groups/10.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'name', :text => 'A Team' @@ -91,7 +91,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should return the builtin group" do get '/groups/12.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'builtin', :text => 'non_member' @@ -102,7 +102,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml should include users if requested" do get '/groups/10.xml?include=users', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'users' do @@ -115,7 +115,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base test "GET /groups/:id.xml include memberships if requested" do get '/groups/10.xml?include=memberships', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'group' do assert_select 'memberships' @@ -128,7 +128,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :params => {:group => {:name => 'Test', :user_ids => [2, 3]}}, :headers => credentials('admin') assert_response :created - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end group = Group.order('id DESC').first @@ -147,7 +147,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :headers => credentials('admin') end assert_response :unprocessable_entity - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'errors' do assert_select 'error', :text => /Name cannot be blank/ @@ -172,7 +172,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base :params => {:group => {:name => ''}}, :headers => credentials('admin') assert_response :unprocessable_entity - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'errors' do assert_select 'error', :text => /Name cannot be blank/ diff --git a/test/integration/api_test/issue_categories_test.rb b/test/integration/api_test/issue_categories_test.rb index 52dae6dba..a6b139f55 100644 --- a/test/integration/api_test/issue_categories_test.rb +++ b/test/integration/api_test/issue_categories_test.rb @@ -29,14 +29,14 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/issue_categories.xml should return the issue categories" do get '/projects/1/issue_categories.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories issue_category id', :text => '2' end test "GET /issue_categories/:id.xml should return the issue category" do get '/issue_categories/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_category id', :text => '2' end @@ -48,7 +48,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type category = IssueCategory.order('id DESC').first assert_equal 'API', category.name @@ -63,7 +63,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end @@ -88,7 +88,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end diff --git a/test/integration/api_test/issue_relations_test.rb b/test/integration/api_test/issue_relations_test.rb index fa6c5a546..842f785e2 100644 --- a/test/integration/api_test/issue_relations_test.rb +++ b/test/integration/api_test/issue_relations_test.rb @@ -33,7 +33,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base get '/issues/9/relations.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relations[type=array] relation id', :text => '1' end @@ -51,7 +51,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base assert_equal 'relates', relation.relation_type assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relation id', :text => relation.id.to_s end @@ -70,7 +70,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base get '/relations/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'relation id', :text => '2' end diff --git a/test/integration/api_test/issue_statuses_test.rb b/test/integration/api_test/issue_statuses_test.rb index 150324ecf..e685b59b0 100644 --- a/test/integration/api_test/issue_statuses_test.rb +++ b/test/integration/api_test/issue_statuses_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::IssueStatusesTest < Redmine::ApiTest::Base get '/issue_statuses.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_statuses[type=array] issue_status id', :text => '2' do assert_select '~ name', :text => 'Assigned' end diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index ecb77dcf7..f524d8052 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -72,7 +72,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml?include=relations' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue id', :text => '3' do assert_select '~ relations relation', 1 @@ -89,7 +89,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml?include=attachments' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue id', :text => '3' do assert_select '~ attachments attachment', 4 @@ -105,7 +105,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml', :params => {:f => ['start_date'], :op => {:start_date => '='}} assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Start date cannot be blank" end @@ -371,7 +371,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues/1.xml?include=watchers', :headers => credentials('jsmith') assert_response :ok - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'watchers', Issue.find(1).watchers.count assert_select 'watchers' do @@ -402,7 +402,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) get '/issues/3.xml' - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'estimated_hours', parent.estimated_hours.to_s assert_select 'total_estimated_hours', (parent.estimated_hours.to_f + 3.0).to_s @@ -418,7 +418,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base Role.anonymous.remove_permission! :view_time_entries get '/issues/3.xml' - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'estimated_hours', parent.estimated_hours.to_s assert_select 'total_estimated_hours', (parent.estimated_hours.to_f + 3.0).to_s @@ -437,7 +437,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) get '/issues/3.xml', :headers => credentials(user.login) - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'issue' do assert_select 'spent_hours', '5.5' assert_select 'total_spent_hours', '7.5' @@ -452,7 +452,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id) get '/issues/3.json' - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal parent.estimated_hours, json['issue']['estimated_hours'] assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours'] @@ -467,7 +467,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base Role.anonymous.remove_permission! :view_time_entries get '/issues/3.json' - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal parent.estimated_hours, json['issue']['estimated_hours'] assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours'] @@ -485,7 +485,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base TimeEntry.generate!(:user => User.find(1), :hours => 100, :issue_id => child.id) get '/issues/3.json', :headers => credentials(user.login) - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 5.5, json['issue']['spent_hours'] assert_equal 7.5, json['issue']['total_spent_hours'] @@ -516,7 +516,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base assert_equal 'API test', issue.subject assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue > id', :text => issue.id.to_s end diff --git a/test/integration/api_test/memberships_test.rb b/test/integration/api_test/memberships_test.rb index 463ddf9bd..76e0f58ef 100644 --- a/test/integration/api_test/memberships_test.rb +++ b/test/integration/api_test/memberships_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/projects/1/memberships.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'memberships[type=array] membership id', :text => '2' do assert_select '~ user[id="3"][name="Dave Lopper"]' assert_select '~ roles role[id="2"][name=Developer]' @@ -37,7 +37,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/projects/1/memberships.json', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 3, json["total_count"] assert_equal 25, json["limit"] @@ -98,7 +98,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Principal cannot be blank" end end @@ -107,7 +107,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/memberships/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'membership id', :text => '2' do assert_select '~ user[id="3"][name="Dave Lopper"]' assert_select '~ roles role[id="2"][name=Developer]' @@ -118,7 +118,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base get '/memberships/2.json', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal( {"membership" => { @@ -150,7 +150,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base :headers => credentials('jsmith') assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Role cannot be empty" end diff --git a/test/integration/api_test/my_test.rb b/test/integration/api_test/my_test.rb index 1749b709a..f53377abd 100644 --- a/test/integration/api_test/my_test.rb +++ b/test/integration/api_test/my_test.rb @@ -27,7 +27,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base get '/my/account.json', :headers => credentials('dlopper', 'foo') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert json.key?('user') assert_equal 'dlopper', json['user']['login'] @@ -82,7 +82,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base }, :headers => credentials('dlopper', 'foo')) assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -96,7 +96,7 @@ class Redmine::ApiTest::MyTest < Redmine::ApiTest::Base }, :headers => credentials('dlopper', 'foo')) assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index 33eae6455..4fa39058d 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.rb @@ -66,7 +66,7 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base test "GET /news/:id.xml" do get "/news/1.xml" assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'news' do assert_select 'id', 1 assert_select "project[id=1][name=\"eCookbook\"]" @@ -81,7 +81,7 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base test "GET /news/:id.json" do get "/news/1.json" assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert_equal 1, json['news']['id'] end diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index 6c7496fc4..96185ce38 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -36,7 +36,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'projects>project:first-child' do assert_select '>id', :text => '1' @@ -49,7 +49,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.json should return projects" do get '/projects.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json @@ -62,7 +62,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=issue_categories should return categories" do get '/projects.xml?include=issue_categories' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' end @@ -70,7 +70,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=trackers should return trackers" do get '/projects.xml?include=trackers' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' end @@ -78,7 +78,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects.xml with include=enabled_modules should return enabled modules" do get '/projects.xml?include=enabled_modules' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]' end @@ -88,7 +88,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'project>id', :text => '1' assert_select 'project>status', :text => '1' @@ -115,7 +115,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base get '/projects/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'custom_field[name=?]', 'Development status', 0 end @@ -123,7 +123,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=issue_categories should return categories" do get '/projects/1.xml?include=issue_categories' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'issue_categories[type=array] issue_category[id="2"][name=Recipes]' end @@ -131,7 +131,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=time_entry_activities should return activities" do get '/projects/1.xml?include=time_entry_activities' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry_activities[type=array] time_entry_activity[id="10"][name=Development]' end @@ -139,7 +139,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=trackers should return trackers" do get '/projects/1.xml?include=trackers' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker[id="2"][name="Feature request"]' end @@ -147,7 +147,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base test "GET /projects/:id.xml with include=enabled_modules should return enabled modules" do get '/projects/1.xml?include=enabled_modules' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]' end @@ -168,7 +168,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base assert_equal Tracker.all.size, project.trackers.size assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'project id', :text => project.id.to_s end @@ -202,7 +202,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Identifier cannot be blank" end @@ -214,7 +214,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :no_content assert_equal '', @response.body - assert_nil @response.content_type + assert_nil @response.media_type project = Project.find(2) assert_equal 'API update', project.name end @@ -251,7 +251,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Name cannot be blank" end diff --git a/test/integration/api_test/queries_test.rb b/test/integration/api_test/queries_test.rb index c3f743766..5ba21778a 100644 --- a/test/integration/api_test/queries_test.rb +++ b/test/integration/api_test/queries_test.rb @@ -33,7 +33,7 @@ class Redmine::ApiTest::QueriesTest < Redmine::ApiTest::Base get '/queries.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'queries[type=array] query id', :text => '4' do assert_select '~ name', :text => 'Public query for all projects' end diff --git a/test/integration/api_test/roles_test.rb b/test/integration/api_test/roles_test.rb index dc2275c08..128882c67 100644 --- a/test/integration/api_test/roles_test.rb +++ b/test/integration/api_test/roles_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'roles role', 3 assert_select 'roles[type=array] role id', :text => '2' do @@ -38,7 +38,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json @@ -51,7 +51,7 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base get '/roles/1.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'role' do assert_select 'name', :text => 'Manager' diff --git a/test/integration/api_test/search_test.rb b/test/integration/api_test/search_test.rb index 891090140..fe592a2b9 100644 --- a/test/integration/api_test/search_test.rb +++ b/test/integration/api_test/search_test.rb @@ -32,14 +32,14 @@ class Redmine::ApiTest::SearchTest < Redmine::ApiTest::Base get '/search.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type end test "GET /search.json should return json content" do get '/search.json' assert_response :success - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json diff --git a/test/integration/api_test/time_entries_test.rb b/test/integration/api_test/time_entries_test.rb index f42d0ae97..ce6d39b96 100644 --- a/test/integration/api_test/time_entries_test.rb +++ b/test/integration/api_test/time_entries_test.rb @@ -32,21 +32,21 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base test "GET /time_entries.xml should return time entries" do get '/time_entries.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entries[type=array] time_entry id', :text => '2' end test "GET /time_entries.xml with limit should return limited results" do get '/time_entries.xml?limit=2', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entries[type=array] time_entry', 2 end test "GET /time_entries/:id.xml should return the time entry" do get '/time_entries/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry id', :text => '2' end @@ -57,7 +57,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base get '/time_entries/2.xml', :headers => credentials('jsmith') assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'time_entry id', :text => '2' end @@ -77,7 +77,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'jsmith', entry.user.login @@ -103,7 +103,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'accepted', entry.custom_field_value(field) @@ -120,7 +120,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type entry = TimeEntry.order('id DESC').first assert_equal 'jsmith', entry.user.login @@ -139,7 +139,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Hours cannot be blank" end @@ -164,7 +164,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :headers => credentials('jsmith')) end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "Hours cannot be blank" end @@ -193,7 +193,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base delete '/time_entries/2.xml', :headers => credentials('jsmith') end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors' end end diff --git a/test/integration/api_test/trackers_test.rb b/test/integration/api_test/trackers_test.rb index 26916c95e..92bdb750f 100644 --- a/test/integration/api_test/trackers_test.rb +++ b/test/integration/api_test/trackers_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base get '/trackers.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'trackers[type=array] tracker id', :text => '2' do assert_select '~ name', :text => 'Feature request' diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 7ffd21f24..3d0722e7d 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -26,7 +26,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users.xml', :headers => credentials('admin') assert_response :success - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'users' do assert_select 'user', User.active.count end @@ -36,7 +36,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users.json', :headers => credentials('admin') assert_response :success - assert_equal 'application/json', response.content_type + assert_equal 'application/json', response.media_type json = ActiveSupport::JSON.decode(response.body) assert json.key?('users') assert_equal User.active.count, json['users'].size @@ -157,7 +157,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert user.check_password?('secret123') assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'user id', :text => user.id.to_s end @@ -200,7 +200,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert !user.admin? assert_response :created - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Hash, json['user'] @@ -220,7 +220,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -237,7 +237,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') @@ -306,7 +306,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'errors error', :text => "First name cannot be blank" end @@ -324,7 +324,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base end assert_response :unprocessable_entity - assert_equal 'application/json', @response.content_type + assert_equal 'application/json', @response.media_type json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert json.has_key?('errors') diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb index a05704d87..e8b0c63cf 100644 --- a/test/integration/api_test/versions_test.rb +++ b/test/integration/api_test/versions_test.rb @@ -35,7 +35,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base get '/projects/1/versions.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'versions[type=array] version id', :text => '2' do assert_select '~ name', :text => '1.0' @@ -53,7 +53,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal 'API test', version.name assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -69,7 +69,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal Date.parse('2012-01-24'), version.due_date assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -85,7 +85,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal WikiPage.first, version.wiki_page assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version id', :text => version.id.to_s end @@ -109,7 +109,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base assert_equal 'Some value', version.custom_field_value(field) assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version>custom_fields>custom_field[id=?]>value', field.id.to_s, 'Some value' end @@ -132,7 +132,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base get '/versions/2.xml' assert_response :success - assert_equal 'application/xml', @response.content_type + assert_equal 'application/xml', @response.media_type assert_select 'version' do assert_select 'id', :text => '2' assert_select 'name', :text => '1.0' diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb index ae980129f..9245f9837 100644 --- a/test/integration/api_test/wiki_pages_test.rb +++ b/test/integration/api_test/wiki_pages_test.rb @@ -27,7 +27,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/index.xml should return wiki pages" do get '/projects/ecookbook/wiki/index.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_pages[type=array]' do assert_select 'wiki_page', :count => Wiki.find(1).pages.count assert_select 'wiki_page' do @@ -46,7 +46,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml should return wiki page" do get '/projects/ecookbook/wiki/CookBook_documentation.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'CookBook_documentation' assert_select 'version', :text => '3' @@ -61,7 +61,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml?include=attachments should include attachments" do get '/projects/ecookbook/wiki/Page_with_an_inline_image.xml?include=attachments' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'Page_with_an_inline_image' assert_select 'attachments[type=array]' do @@ -76,13 +76,13 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base test "GET /projects/:project_id/wiki/:title.xml with unknown title and edit permission should respond with 404" do get '/projects/ecookbook/wiki/Invalid_Page.xml', :headers => credentials('jsmith') assert_response 404 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end test "GET /projects/:project_id/wiki/:title/:version.xml should return wiki page version" do get '/projects/ecookbook/wiki/CookBook_documentation/2.xml' assert_response 200 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type assert_select 'wiki_page' do assert_select 'title', :text => 'CookBook_documentation' assert_select 'version', :text => '2' @@ -99,7 +99,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base get '/projects/ecookbook/wiki/CookBook_documentation/2.xml' assert_response 401 - assert_equal 'application/xml', response.content_type + assert_equal 'application/xml', response.media_type end test "PUT /projects/:project_id/wiki/:title.xml should update wiki page" do diff --git a/test/integration/attachments_test.rb b/test/integration/attachments_test.rb index 5802d36c5..1ff423e5d 100644 --- a/test/integration/attachments_test.rb +++ b/test/integration/attachments_test.rb @@ -167,7 +167,7 @@ class AttachmentsTest < Redmine::IntegrationTest :params => content, :headers => {"CONTENT_TYPE" => 'application/octet-stream'}) assert_response :success - assert_equal 'text/javascript', response.content_type + assert_equal 'text/javascript', response.media_type end token = response.body.match(/\.val\('(\d+\.[0-9a-f]+)'\)/)[1] diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb index cd4159d9a..5b9dcfbf0 100644 --- a/test/integration/welcome_test.rb +++ b/test/integration/welcome_test.rb @@ -26,7 +26,7 @@ class WelcomeTest < Redmine::IntegrationTest def test_robots get '/robots.txt' assert_response :success - assert_equal 'text/plain', @response.content_type + assert_equal 'text/plain', @response.media_type # Redmine::Utils.relative_url_root does not effect on Rails 5.1.4. assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0c1217fea..b3956e9af 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -348,7 +348,7 @@ module Redmine # Saves the generated PDF in tmp/test/pdf def save_pdf - assert_equal 'application/pdf', response.content_type + assert_equal 'application/pdf', response.media_type filename = "#{self.class.name.underscore}__#{method_name}.pdf" File.open(File.join($redmine_tmp_pdf_directory, filename), "wb") do |f| f.write response.body @@ -431,8 +431,8 @@ module Redmine # Parses the response body based on its content type def response_data - unless response.content_type.to_s =~ /^application\/(.+)/ - raise "Unexpected response type: #{response.content_type}" + unless response.media_type.to_s =~ /^application\/(.+)/ + raise "Unexpected response type: #{response.media_type}" end format = $1 |