summaryrefslogtreecommitdiff
path: root/spec/models/commit_status_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/models/commit_status_spec.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 05d3329215a..85fc503a1ca 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -96,6 +96,21 @@ describe CommitStatus do
it { is_expected.to be_truthy }
end
+
+ it "processed state is always persisted" do
+ commit_status.update!(retried: false, status: :pending)
+
+ # another process does mark object as processed
+ CommitStatus.find(commit_status.id).update_column(:processed, true)
+
+ # subsequent status transitions on the same instance
+ # always saves processed=false to DB even though
+ # the current value did not change
+ commit_status.update!(retried: false, status: :running)
+
+ # we look at a persisted state in DB
+ expect(CommitStatus.find(commit_status.id).processed).to eq(false)
+ end
end
end
@@ -235,7 +250,7 @@ describe CommitStatus do
context 'if the building process has started' do
before do
- commit_status.started_at = Time.now - 1.minute
+ commit_status.started_at = Time.current - 1.minute
commit_status.finished_at = nil
end
@@ -708,7 +723,7 @@ describe CommitStatus do
end
describe '#enqueue' do
- let!(:current_time) { Time.new(2018, 4, 5, 14, 0, 0) }
+ let!(:current_time) { Time.zone.local(2018, 4, 5, 14, 0, 0) }
before do
allow(Time).to receive(:now).and_return(current_time)