/media_assets: add basic index and show pages.
* Add a basic index page at https://danbooru.donmai.us/media_assets. * Add a basic show page at https://danbooru.donmai.us/media_assets/1. * Add ability to search /media_assets.json by metadata. Example: ** https://danbooru.donmai.us/media_assets.json?search[metadata][File:ColorComponents]=3 * Add a "»" link next to the filesize on posts linking to the metadata page. Known issues: * Sometimes the MD5 links on the /media_assets page return "That record was not found" errors. These are unfinished uploads that haven't been made into posts yet. * No good way to search for custom metadata fields in the search form. * Design is ugly.
This commit is contained in:
@@ -3,12 +3,28 @@ require 'test_helper'
|
||||
class MediaAssetsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "The media assets controller" do
|
||||
context "index action" do
|
||||
setup do
|
||||
@media_asset = create(:media_asset)
|
||||
end
|
||||
|
||||
should "render" do
|
||||
create(:media_asset)
|
||||
get media_assets_path, as: :json
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should respond_to_search({}).with { @media_asset }
|
||||
should respond_to_search(metadata: { "File:ColorComponents" => 3 }).with { @media_asset }
|
||||
should respond_to_search(metadata: { "File:ColorComponents" => 4 }).with { [] }
|
||||
end
|
||||
|
||||
context "show action" do
|
||||
should "render" do
|
||||
@media_asset = create(:media_asset)
|
||||
get media_asset_path(@media_asset), as: :json
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user