Fix state=all 500 error bug (#4525) [ci skip]
This commit is contained in:
parent
73caa9a864
commit
80316818d5
2 changed files with 6 additions and 1 deletions
|
|
@ -29,7 +29,7 @@ class ArticleApiIndexService
|
|||
base_articles
|
||||
end
|
||||
|
||||
articles.decorate
|
||||
articles&.decorate
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue