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:
authorShinya Maeda <shinya@gitlab.com>2018-07-04 09:11:05 +0300
committerShinya Maeda <shinya@gitlab.com>2018-07-04 09:11:05 +0300
commit5d0c43ba81c7a08c9cd9320d55bbed439827ecad (patch)
tree4717a2e2d4e984c9fff87054c53cb3f1917c2130
parentd323f6fadd03eb95bc5ea30f1f8c75b01179e139 (diff)
Fix spec and added a spec for Trace#write
-rw-r--r--spec/support/shared_examples/ci_trace_shared_examples.rb22
-rw-r--r--spec/workers/ci/archive_traces_cron_worker_spec.rb2
2 files changed, 23 insertions, 1 deletions
diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb
index db723a323f8..cf2d63c8bc0 100644
--- a/spec/support/shared_examples/ci_trace_shared_examples.rb
+++ b/spec/support/shared_examples/ci_trace_shared_examples.rb
@@ -138,6 +138,28 @@ shared_examples_for 'common trace features' do
end
end
+ describe '#write' do
+ subject { trace.send(:write, mode) { } }
+
+ let(:mode) { 'wb' }
+
+ context 'when arhicved trace does not exist yet' do
+ it 'does not raise an error' do
+ expect { subject }.not_to raise_error
+ end
+ end
+
+ context 'when arhicved trace already exists' do
+ before do
+ create(:ci_job_artifact, :trace, job: build)
+ end
+
+ it 'raises an error' do
+ expect { subject }.to raise_error('Already archived')
+ end
+ end
+ end
+
describe '#set' do
before do
trace.set("12")
diff --git a/spec/workers/ci/archive_traces_cron_worker_spec.rb b/spec/workers/ci/archive_traces_cron_worker_spec.rb
index 9af51b7d4d8..4c3940433fa 100644
--- a/spec/workers/ci/archive_traces_cron_worker_spec.rb
+++ b/spec/workers/ci/archive_traces_cron_worker_spec.rb
@@ -31,7 +31,7 @@ describe Ci::ArchiveTracesCronWorker do
it_behaves_like 'archives trace'
context 'when archive raised an exception' do
- let!(:build) { create(:ci_build, :success, :trace_artifact, :trace_live) }
+ let!(:build) { create(:ci_build, :success, :trace_live, :trace_artifact) }
let!(:build2) { create(:ci_build, :success, :trace_live) }
it 'archives valid targets' do