diff options
author | Nick Thomas <nick@gitlab.com> | 2017-08-15 15:56:04 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-08-22 11:54:46 +0300 |
commit | 6e8d0b78ebbde2eada151649fc7d1040b902e28f (patch) | |
tree | 51e1665f62fa4d78e64d26e13c00e07c4ca5605a /spec/workers/authorized_projects_worker_spec.rb | |
parent | 6509833cfa211804048ec4711572e3b44a5be21c (diff) |
Use event-based waiting in Gitlab::JobWaiter
Diffstat (limited to 'spec/workers/authorized_projects_worker_spec.rb')
-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 |