diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-08-22 14:05:14 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-08-22 14:05:14 +0300 |
commit | 78a0d27e98cea4ed1b59377edc93588127b297fe (patch) | |
tree | 626ddaa692571518058e4d4f48a627cecba04f4f /spec/workers | |
parent | 28501691da41e1593a822061549d29a6a946d7a3 (diff) | |
parent | 6e8d0b78ebbde2eada151649fc7d1040b902e28f (diff) |
Merge branch '34533-inline-single-authorized-projects' into 'master'
Use an event-based system when waiting for AuthorizedProjectsWorker to complete
See merge request !13564
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/authorized_projects_worker_spec.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/spec/workers/authorized_projects_worker_spec.rb b/spec/workers/authorized_projects_worker_spec.rb index 03b9b99e263..f8385ae7c72 100644 --- a/spec/workers/authorized_projects_worker_spec.rb +++ b/spec/workers/authorized_projects_worker_spec.rb @@ -29,21 +29,27 @@ describe AuthorizedProjectsWorker do end describe '#perform' do - subject { described_class.new } + let(:user) { create(:user) } - it "refreshes user's authorized projects" do - user = create(:user) + subject(:job) { described_class.new } + it "refreshes user's authorized projects" do expect_any_instance_of(User).to receive(:refresh_authorized_projects) - subject.perform(user.id) + job.perform(user.id) + end + + it 'notifies the JobWaiter when done if the key is provided' do + expect(Gitlab::JobWaiter).to receive(:notify).with('notify-key', job.jid) + + job.perform(user.id, 'notify-key') end context "when the user is not found" do it "does nothing" do expect_any_instance_of(User).not_to receive(:refresh_authorized_projects) - subject.perform(-1) + job.perform(-1) end end end |