Fix state=all 500 error bug (#4525) [ci skip]

This commit is contained in:
Aleksandr 2019-10-24 00:19:47 +03:00 committed by Mac Siri
parent 73caa9a864
commit 80316818d5
2 changed files with 6 additions and 1 deletions

View file

@ -29,7 +29,7 @@ class ArticleApiIndexService
base_articles
end
articles.decorate
articles&.decorate
end
private

View file

@ -15,6 +15,11 @@ RSpec.describe "Api::V0::Articles", type: :request do
expect(response.content_type).to eq("application/json")
end
it "returns nothing if params state=all is not found" do
get api_articles_path(state: "all")
expect(json_response.size).to eq(0)
end
it "returns featured articles if no param is given" do
article.update_column(:featured, true)
get api_articles_path