mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 17:51:03 +08:00
FIX: Make error in Discourse Hub more descriptive. (#6438)
This commit is contained in:

committed by
Régis Hanol

parent
47f19adac8
commit
1fb1f4c790
@ -75,4 +75,25 @@ describe DiscourseHub do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.collection_action' do
|
||||
|
||||
it 'should log a warning if status is not 200' do
|
||||
stub_request(:get, (ENV['HUB_BASE_URL'] || "http://local.hub:3000/api")).
|
||||
to_return(status: 500, body: "", headers: {})
|
||||
|
||||
Rails.logger.expects(:warn)
|
||||
|
||||
DiscourseHub.collection_action(:get, "")
|
||||
end
|
||||
|
||||
it 'should log an error if response is invalid JSON' do
|
||||
stub_request(:get, (ENV['HUB_BASE_URL'] || "http://local.hub:3000/api")).
|
||||
to_return(status: 200, body: "this is not valid JSON", headers: {})
|
||||
|
||||
Rails.logger.expects(:error)
|
||||
|
||||
DiscourseHub.collection_action(:get, "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user