diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-11 15:25:17 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-18 21:25:45 +0300 |
commit | fd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch) | |
tree | 39a4ac60382ca7ce8d46e3745ba8a381580d6314 /spec/workers/authorized_projects_worker_spec.rb | |
parent | aea8baed3093c513560e9ac5ac0c5c99508d3001 (diff) |
Precalculate user's authorized projects in database
Closes #23150
Diffstat (limited to 'spec/workers/authorized_projects_worker_spec.rb')
-rw-r--r-- | spec/workers/authorized_projects_worker_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/workers/authorized_projects_worker_spec.rb b/spec/workers/authorized_projects_worker_spec.rb new file mode 100644 index 00000000000..18a1aab766c --- /dev/null +++ b/spec/workers/authorized_projects_worker_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe AuthorizedProjectsWorker do + describe '#perform' do + it "refreshes user's authorized projects" do + user = create(:user) + + expect(User).to receive(:find_by).with(id: user.id).and_return(user) + expect(user).to receive(:refresh_authorized_projects) + + described_class.new.perform(user.id) + end + + context "when user is not found" do + it "does nothing" do + expect_any_instance_of(User).not_to receive(:refresh_authorized_projects) + + described_class.new.perform(999_999) + end + end + end +end |