evazion
2021-09-15 23:32:32 -05:00
parent 9cc8d8aa4a
commit ea6e47125e
5 changed files with 83 additions and 13 deletions

View File

@@ -9,6 +9,26 @@ class MediaMetadataControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
context "searching" do
setup do
@jpg = create(:media_metadata, file: "test/files/test.jpg")
@gif = create(:media_metadata, file: "test/files/test.gif")
@png = create(:media_metadata, file: "test/files/test.png")
end
should respond_to_search(has_metadata: true).with { [@png, @gif, @jpg] }
should respond_to_search(metadata_has_key: "File:ColorComponents").with { [@jpg] }
should respond_to_search(metadata: { "File:ColorComponents": 3 }).with { [@jpg] }
should respond_to_search(metadata: { "File:ColorComponents": "3" }).with { [@jpg] }
should respond_to_search(metadata_has_key: "GIF:GIFVersion").with { [@gif] }
should respond_to_search(metadata: { "GIF:GIFVersion": "89a" }).with { [@gif] }
should respond_to_search(metadata_has_key: "PNG:ColorType").with { [@png] }
should respond_to_search(metadata: { "PNG:ColorType": "RGB" }).with { [@png] }
end
end
end
end