Fix #5184: undefined method `to_model' for []:Array searching for IQDB queries with JSON.
This commit is contained in:
@@ -35,6 +35,19 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select("#post_#{@post.id}")
|
||||
end
|
||||
end
|
||||
|
||||
context "with a file parameter" do
|
||||
should "render a response" do
|
||||
@matches = [{ post_id: @post.id, score: 95.0 }]
|
||||
mock_iqdb_matches(@matches)
|
||||
|
||||
file = Rack::Test::UploadedFile.new("test/files/test.jpg")
|
||||
post_auth iqdb_queries_path(format: :json), @user, params: { search: { file: file }}
|
||||
|
||||
assert_response :success
|
||||
assert_equal([{ post_id: @post.id, score: 95.0, post: as(@user) { @post.as_json } }.with_indifferent_access], response.parsed_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user