diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb')
-rw-r--r-- | spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb b/spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb new file mode 100644 index 00000000000..a0aae00776d --- /dev/null +++ b/spec/migrations/20210722042939_update_issuable_slas_where_issue_closed_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration!('update_issuable_slas_where_issue_closed') + +RSpec.describe UpdateIssuableSlasWhereIssueClosed, :migration do + let(:namespaces) { table(:namespaces) } + let(:projects) { table(:projects) } + let(:issues) { table(:issues) } + let(:issuable_slas) { table(:issuable_slas) } + let(:issue_params) { { title: 'title', project_id: project.id } } + let(:issue_closed_state) { 2 } + + let!(:namespace) { namespaces.create!(name: 'foo', path: 'foo') } + let!(:project) { projects.create!(namespace_id: namespace.id) } + let!(:issue_open) { issues.create!(issue_params) } + let!(:issue_closed) { issues.create!(issue_params.merge(state_id: issue_closed_state)) } + + let!(:issuable_sla_open_issue) { issuable_slas.create!(issue_id: issue_open.id, due_at: Time.now) } + let!(:issuable_sla_closed_issue) { issuable_slas.create!(issue_id: issue_closed.id, due_at: Time.now) } + + it 'sets the issuable_closed attribute to false' do + expect(issuable_sla_open_issue.issuable_closed).to eq(false) + expect(issuable_sla_closed_issue.issuable_closed).to eq(false) + + migrate! + + expect(issuable_sla_open_issue.reload.issuable_closed).to eq(false) + expect(issuable_sla_closed_issue.reload.issuable_closed).to eq(true) + end +end |