FIX: Display json response when Discourse::InvalidAccess is raised for

non json requests.
This commit is contained in:
Guo Xiang Tan
2017-09-28 15:29:57 +08:00
parent 373fd8990e
commit 5f1c29e424
2 changed files with 10 additions and 1 deletions

View File

@ -1064,6 +1064,14 @@ describe TopicsController do
}, format: :json
expect(response.code.to_i).to be(403)
expect(response.body).to eq(I18n.t("invalid_access"))
get :show, params: {
topic_id: topic.id, slug: topic.slug, api_key: "bad"
}, format: :html
expect(response.code.to_i).to be(403)
expect(response.body).to eq(I18n.t("invalid_access"))
end
end
end