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:
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb56
1 files changed, 20 insertions, 36 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 5bc61db6d21..68d12f51d4b 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -254,26 +254,6 @@ RSpec.describe Deployment do
deployment.send(event)
end
-
- context 'the feature is disabled' do
- it 'does not trigger a worker' do
- stub_feature_flags(jira_sync_deployments: false)
-
- expect(worker).not_to receive(:perform_async)
-
- deployment.send(event)
- end
- end
-
- context 'the feature is enabled for this project' do
- it 'does trigger a worker' do
- stub_feature_flags(jira_sync_deployments: deployment.project)
-
- expect(worker).to receive(:perform_async)
-
- deployment.send(event)
- end
- end
end
end
end
@@ -416,6 +396,26 @@ RSpec.describe Deployment do
end
end
+ describe '.finished_before' do
+ let!(:deployment1) { create(:deployment, finished_at: 1.day.ago) }
+ let!(:deployment2) { create(:deployment, finished_at: Time.current) }
+
+ it 'filters deployments by finished_at' do
+ expect(described_class.finished_before(1.hour.ago))
+ .to eq([deployment1])
+ end
+ end
+
+ describe '.finished_after' do
+ let!(:deployment1) { create(:deployment, finished_at: 1.day.ago) }
+ let!(:deployment2) { create(:deployment, finished_at: Time.current) }
+
+ it 'filters deployments by finished_at' do
+ expect(described_class.finished_after(1.hour.ago))
+ .to eq([deployment2])
+ end
+ end
+
describe 'with_deployable' do
subject { described_class.with_deployable }
@@ -428,22 +428,6 @@ RSpec.describe Deployment do
end
end
- describe 'finished_between' do
- subject { described_class.finished_between(start_time, end_time) }
-
- let_it_be(:start_time) { DateTime.new(2017) }
- let_it_be(:end_time) { DateTime.new(2019) }
- let_it_be(:deployment_2016) { create(:deployment, finished_at: DateTime.new(2016)) }
- let_it_be(:deployment_2017) { create(:deployment, finished_at: DateTime.new(2017)) }
- let_it_be(:deployment_2018) { create(:deployment, finished_at: DateTime.new(2018)) }
- let_it_be(:deployment_2019) { create(:deployment, finished_at: DateTime.new(2019)) }
- let_it_be(:deployment_2020) { create(:deployment, finished_at: DateTime.new(2020)) }
-
- it 'retrieves deployments that finished between the specified times' do
- is_expected.to contain_exactly(deployment_2017, deployment_2018)
- end
- end
-
describe 'visible' do
subject { described_class.visible }