Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-22 15:58:10 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-22 15:58:10 +0300
commit2e91f18143d42831c37b7429c3583fbd9b4d49b8 (patch)
treeacb3a7ec63872f77a0d71c51df27e1831994ce32 /spec/workers
parent3366e38cc1632eba4c9e8683555c6fde6efd5d48 (diff)
parent78a0d27e98cea4ed1b59377edc93588127b297fe (diff)
Merge branch 'master' into backstage/gb/rename-ci-cd-processing-sidekiq-queues
* master: (115 commits) Use event-based waiting in Gitlab::JobWaiter Make sure repository's removal work for legacy and hashed storages Use `@hashed` prefix for hashed paths on disk, to avoid collision with existing ones Refactor project and storage types Prevent using gitlab import task when hashed storage is enabled Some codestyle changes and fixes for GitLab pages Removed some useless code, codestyle changes and removed an index Fix repository reloading in some specs Changelog Moving away from the "extend" based factory to a more traditional one. Enable automatic hashed storage for new projects by application settings New storage is now "Hashed" instead of "UUID" Add UUID Storage to Project Move create_repository back to project model as we can use disk_path and share it Codestyle: move hooks to the same place and move dependent methods to private Use non-i18n values for setting new group-level issue/MR button text indexes external issue tracker copyedit indexes user/search/ from /user/index Correctly encode string params for Gitaly's TreeEntries RPC ...
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/authorized_projects_worker_spec.rb16
-rw-r--r--spec/workers/namespaceless_project_destroy_worker_spec.rb2
-rw-r--r--spec/workers/stage_update_worker_spec.rb22
3 files changed, 34 insertions, 6 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
diff --git a/spec/workers/namespaceless_project_destroy_worker_spec.rb b/spec/workers/namespaceless_project_destroy_worker_spec.rb
index f2706254284..817e103fd9a 100644
--- a/spec/workers/namespaceless_project_destroy_worker_spec.rb
+++ b/spec/workers/namespaceless_project_destroy_worker_spec.rb
@@ -5,7 +5,7 @@ describe NamespacelessProjectDestroyWorker do
before do
# Stub after_save callbacks that will fail when Project has no namespace
- allow_any_instance_of(Project).to receive(:ensure_storage_path_exist).and_return(nil)
+ allow_any_instance_of(Project).to receive(:ensure_storage_path_exists).and_return(nil)
allow_any_instance_of(Project).to receive(:update_project_statistics).and_return(nil)
end
diff --git a/spec/workers/stage_update_worker_spec.rb b/spec/workers/stage_update_worker_spec.rb
new file mode 100644
index 00000000000..7bc76c79464
--- /dev/null
+++ b/spec/workers/stage_update_worker_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe StageUpdateWorker do
+ describe '#perform' do
+ context 'when stage exists' do
+ let(:stage) { create(:ci_stage_entity) }
+
+ it 'updates stage status' do
+ expect_any_instance_of(Ci::Stage).to receive(:update_status)
+
+ described_class.new.perform(stage.id)
+ end
+ end
+
+ context 'when stage does not exist' do
+ it 'does not raise exception' do
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
+ end
+ end
+ end
+end