refactor iqdb query support
This commit is contained in:
@@ -7,28 +7,12 @@ class IqdbQueriesControllerTest < ActionDispatch::IntegrationTest
|
||||
as_user do
|
||||
@posts = FactoryBot.create_list(:post, 2)
|
||||
end
|
||||
mock_iqdb_service!
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
should "render with a post_id" do
|
||||
mock_iqdb_matches!(@posts[0], @posts)
|
||||
post_auth iqdb_queries_path, @user, params: { post_id: @posts[0].id, format: "js" }
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "render with an url" do
|
||||
mock_iqdb_matches!(@posts[0].source, @posts)
|
||||
post_auth iqdb_queries_path, @user, params: { url: @posts[0].source }
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "render for a json response" do
|
||||
mock_iqdb_matches!(@posts[0].source, @posts)
|
||||
get_auth iqdb_queries_path, @user, params: { url: @posts[0].source, format: "json" }
|
||||
|
||||
context "show action" do
|
||||
should "render with matches" do
|
||||
json = @posts.map {|x| [x.id, 1]}.to_json
|
||||
get_auth iqdb_queries_path, @user, params: { matches: json }
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user