summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-03-20 09:57:36 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-03-20 09:57:36 +0000
commitd685633a833a580ed607faf84cb1398798178acb (patch)
tree7697ee2acb93dbd1c1e42b4ec7fd28b97621d34c /spec
parent216ead607cb3549e9d4ac36b2c1c84507fe97200 (diff)
parent301c4ef9502e02799e64937b35fb47b2e15827b3 (diff)
downloadgitlab-ce-d685633a833a580ed607faf84cb1398798178acb.tar.gz
Merge branch 'fix/sm/erase_old_trace' into 'master'
Use update_column than write_attribute and save Closes #44366 See merge request gitlab-org/gitlab-ce!17861
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ci/trace_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/trace_spec.rb b/spec/lib/gitlab/ci/trace_spec.rb
index 448c6fb57dd..3a9371ed2e8 100644
--- a/spec/lib/gitlab/ci/trace_spec.rb
+++ b/spec/lib/gitlab/ci/trace_spec.rb
@@ -510,6 +510,28 @@ describe Gitlab::Ci::Trace do
it_behaves_like 'source trace in database stays intact', error: ActiveRecord::RecordInvalid
end
+
+ context 'when there is a validation error on Ci::Build' do
+ before do
+ allow_any_instance_of(Ci::Build).to receive(:save).and_return(false)
+ allow_any_instance_of(Ci::Build).to receive_message_chain(:errors, :full_messages)
+ .and_return(%w[Error Error])
+ end
+
+ context "when erase old trace with 'save'" do
+ before do
+ build.send(:write_attribute, :trace, nil)
+ build.save
+ end
+
+ it 'old trace is not deleted' do
+ build.reload
+ expect(build.trace.raw).to eq(trace_content)
+ end
+ end
+
+ it_behaves_like 'archive trace in database'
+ end
end
end