summaryrefslogtreecommitdiff
path: root/spec/workers/gitlab_usage_ping_worker_spec.rb
diff options
context:
space:
mode:
authorTaurie Davis, Simon Knox and Adam Niedzielski <awesome@gitlab.com>2017-05-24 12:25:44 +0200
committerAdam Niedzielski <adamsunday@gmail.com>2017-06-01 17:37:21 +0200
commit26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb (patch)
treef0168cb9ad0be7c4bf8657a5321e5da0bda8e83b /spec/workers/gitlab_usage_ping_worker_spec.rb
parentc72abcefe79dd906cbbf0088b442a8979e9fc746 (diff)
downloadgitlab-ce-26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb.tar.gz
Add Conversational Development Index page to admin panel
Diffstat (limited to 'spec/workers/gitlab_usage_ping_worker_spec.rb')
-rw-r--r--spec/workers/gitlab_usage_ping_worker_spec.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/spec/workers/gitlab_usage_ping_worker_spec.rb b/spec/workers/gitlab_usage_ping_worker_spec.rb
index 26241044533..49b4e04dc7c 100644
--- a/spec/workers/gitlab_usage_ping_worker_spec.rb
+++ b/spec/workers/gitlab_usage_ping_worker_spec.rb
@@ -3,21 +3,11 @@ require 'spec_helper'
describe GitlabUsagePingWorker do
subject { described_class.new }
- it "sends POST request" do
- stub_application_setting(usage_ping_enabled: true)
+ it 'delegates to SubmitUsagePingService' do
+ allow(subject).to receive(:try_obtain_lease).and_return(true)
- stub_request(:post, "https://version.gitlab.com/usage_data").
- to_return(status: 200, body: '', headers: {})
- expect(Gitlab::UsageData).to receive(:to_json).with({ force_refresh: true }).and_call_original
- expect(subject).to receive(:try_obtain_lease).and_return(true)
+ expect_any_instance_of(SubmitUsagePingService).to receive(:execute)
- expect(subject.perform.response.code.to_i).to eq(200)
- end
-
- it "does not run if usage ping is disabled" do
- stub_application_setting(usage_ping_enabled: false)
-
- expect(subject).not_to receive(:try_obtain_lease)
- expect(subject).not_to receive(:perform)
+ subject.perform
end
end