require'spec_helper'describeGitlabUsagePingWorkerdosubject{GitlabUsagePingWorker.new}it"sends POST request"dostub_application_setting(usage_ping_enabled: true)stub_request(:post,"https://version.gitlab.com/usage_data").to_return(status: 200,body: '',headers: {})expect(subject).toreceive(:try_obtain_lease).and_return(true)expect(subject.perform.response.code.to_i).toeq(200)endit"does not run if usage ping is disabled"dostub_application_setting(usage_ping_enabled: false)expect(subject).not_toreceive(:try_obtain_lease)expect(subject).not_toreceive(:perform)endend