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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/lib/gitlab/github_gists_import/status_spec.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_gists_import/status_spec.rb')
-rw-r--r--spec/lib/gitlab/github_gists_import/status_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_gists_import/status_spec.rb b/spec/lib/gitlab/github_gists_import/status_spec.rb
new file mode 100644
index 00000000000..4cbbbd430eb
--- /dev/null
+++ b/spec/lib/gitlab/github_gists_import/status_spec.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::GithubGistsImport::Status, :clean_gitlab_redis_cache, feature_category: :importer do
+ subject(:import_status) { described_class.new(user.id) }
+
+ let_it_be(:user) { create(:user) }
+ let(:key) { "gitlab:github-gists-import:#{user.id}" }
+
+ describe '#start!' do
+ it 'expires the key' do
+ import_status.start!
+
+ Gitlab::Redis::SharedState.with do |redis|
+ expect(redis.get(key)).to eq('started')
+ end
+ end
+ end
+
+ describe '#fail!' do
+ it 'sets failed status' do
+ import_status.fail!
+
+ Gitlab::Redis::SharedState.with do |redis|
+ expect(redis.get(key)).to eq('failed')
+ end
+ end
+ end
+
+ describe '#finish!' do
+ it 'sets finished status' do
+ import_status.finish!
+
+ Gitlab::Redis::SharedState.with do |redis|
+ expect(redis.get(key)).to eq('finished')
+ end
+ end
+ end
+
+ describe '#started?' do
+ before do
+ Gitlab::Redis::SharedState.with { |redis| redis.set(key, 'started') }
+ end
+
+ it 'checks if status is started' do
+ expect(import_status.started?).to eq(true)
+ end
+ end
+end