Merge pull request #4935 from albaguirre/fix-version-check

FIX: version check
This commit is contained in:
Guo Xiang Tan 2017-06-19 07:49:11 +09:00 committed by GitHub
commit baa80c9004
2 changed files with 4 additions and 2 deletions

View File

@ -42,8 +42,9 @@ module DiscourseHub
def self.singular_action(action, rel_url, params={}) def self.singular_action(action, rel_url, params={})
JSON.parse(Excon.send(action, JSON.parse(Excon.send(action,
"#{hub_base_url}#{rel_url}", "#{hub_base_url}#{rel_url}",
body: params.to_query, headers: { 'Referer' => referer, 'Accept' => accepts.join(', ') },
headers: { 'Referer' => referer, 'Accept' => accepts.join(', ') } :query => params,
:omit_default_port => true
).body) ).body)
end end

View File

@ -7,6 +7,7 @@ describe DiscourseHub do
hub_response = {'success' => 'OK', 'latest_version' => '0.8.1', 'critical_updates' => false} hub_response = {'success' => 'OK', 'latest_version' => '0.8.1', 'critical_updates' => false}
stub_request(:get, (ENV['HUB_BASE_URL'] || "http://local.hub:3000/api") + "/version_check"). stub_request(:get, (ENV['HUB_BASE_URL'] || "http://local.hub:3000/api") + "/version_check").
with(query: DiscourseHub.version_check_payload).
to_return(status: 200, body: hub_response.to_json) to_return(status: 200, body: hub_response.to_json)
expect(DiscourseHub.discourse_version_check).to eq(hub_response) expect(DiscourseHub.discourse_version_check).to eq(hub_response)