)
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
)
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
)
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
}
)
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
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 => /日本語/
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/
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/
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
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
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
@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
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
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
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
}
)
assert_response :success
- assert_equal 'image/png', response.content_type
+ assert_equal 'image/png', response.media_type
etag = @response.etag
assert_not_nil etag
}
)
assert_response :success
- assert_equal 'image/png', response.content_type
+ assert_equal 'image/png', response.media_type
end
else
puts '(GhostScript convert not available)'
: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
},
: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
: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
: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
:format => 'png'
}
assert_response :success
- assert_equal 'image/png', @response.content_type
+ assert_equal 'image/png', @response.media_type
end
end
:xhr => true
)
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
def test_add_users
: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
:xhr => true
)
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
end
:xhr => true
)
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
def test_create
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
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
},
: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
: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
: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
}
)
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
get(:index, :params => {:format => 'pdf'})
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
get(
:index,
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
get(
:index,
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
end
end
end
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
end
def test_index_atom
}
)
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'
}
)
assert_response :success
- assert_equal 'application/pdf', response.content_type
+ assert_equal 'application/pdf', response.media_type
end
def test_index_with_description_column
}
)
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
}
)
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
}
}
)
- assert_equal 'text/html', @response.content_type
+ assert_equal 'text/html', @response.media_type
assert_select_error /Start date cannot be blank/i
end
:format => 'csv'
}
)
- assert_equal 'text/csv', @response.content_type
+ assert_equal 'text/csv', @response.media_type
assert @response.body.blank?
end
}
)
assert_response :success
- assert_equal 'application/atom+xml', response.content_type
+ assert_equal 'application/atom+xml', response.media_type
# Inline image
assert_select(
'content',
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
assert @response.body.starts_with?('%PDF')
end
}
)
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
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
assert @response.body.starts_with?('%PDF')
end
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
assert @response.body.starts_with?('%PDF')
end
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
assert @response.body.starts_with?('%PDF')
end
}
)
assert_response :success
- assert_equal 'application/pdf', @response.content_type
+ assert_equal 'application/pdf', @response.media_type
assert @response.body.starts_with?('%PDF')
end
}
)
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
: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
: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
: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
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
:xhr => true
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
def test_create
},
: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))
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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
},
: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"
},
: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
},
: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
},
: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
},
: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
},
: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
},
:xhr => true
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
end
},
:xhr => true
assert_response :success
- assert_equal 'text/javascript', response.content_type
+ assert_equal 'text/javascript', response.media_type
end
end
end
: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
: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
}
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
}
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
}
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
}
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
: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
: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
: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
: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
: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
: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
: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
: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
}
)
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']
}
)
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']
: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
: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
}
)
assert_response :success
- assert_equal 'text/html', @response.content_type
+ assert_equal 'text/html', @response.media_type
assert_select 'p.nodata'
end
end
}
)
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
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)
: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)
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
@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
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
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
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"
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
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
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/
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/
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
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
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'
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
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
: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
: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
"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)
"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)
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
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'
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
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
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
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']
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'
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'
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
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'
: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
: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/
: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/
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
: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
: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
: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
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
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
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
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
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
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
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
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
: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
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
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'
: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']
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']
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']
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
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]'
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"]
: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
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]'
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" => {
: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
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']
},
: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
},
: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')
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\"]"
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
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'
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
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
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
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
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'
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
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
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
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
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
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
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
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
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
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
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
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
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'
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
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
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
: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
: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)
: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
: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
: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
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
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'
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
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
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
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']
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
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')
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
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')
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'
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
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
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
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
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'
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
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'
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
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'
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
: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]
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
# 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
# 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