Commit f9af7819 authored by Michał Zając's avatar Michał Zając

Use dismissed_{at,by} instead of closed_{at,by}

Change all occurrences of closed_{at,by} in Vulnerabilities-related
code to reflect the database changes.
parent 2de9f447
......@@ -20,7 +20,7 @@ class Vulnerability < ApplicationRecord
belongs_to :updated_by, class_name: 'User'
belongs_to :last_edited_by, class_name: 'User'
belongs_to :resolved_by, class_name: 'User'
belongs_to :closed_by, class_name: 'User'
belongs_to :dismissed_by, class_name: 'User'
belongs_to :confirmed_by, class_name: 'User'
has_many :findings, class_name: 'Vulnerabilities::Occurrence', inverse_of: :vulnerability
......
......@@ -23,7 +23,7 @@ module Vulnerabilities
raise ActiveRecord::Rollback
end
@vulnerability.update(state: Vulnerability.states[:dismissed], closed_by: @user, closed_at: Time.current)
@vulnerability.update(state: Vulnerability.states[:dismissed], dismissed_by: @user, dismissed_at: Time.current)
end
@vulnerability
......
......@@ -926,7 +926,7 @@ module EE
expose :updated_by_id
expose :last_edited_by_id
expose :resolved_by_id
expose :closed_by_id
expose :dismissed_by_id
expose :start_date
expose :due_date
......@@ -935,7 +935,7 @@ module EE
expose :updated_at
expose :last_edited_at
expose :resolved_at
expose :closed_at
expose :dismissed_at
end
class VulnerabilityRelatedIssue < ::API::Entities::IssueBasic
......
......@@ -21,7 +21,7 @@ FactoryBot.define do
trait :dismissed do
state { Vulnerability.states[:dismissed] }
closed_at { Time.current }
dismissed_at { Time.current }
end
trait :confirmed do
......
......@@ -36,7 +36,7 @@ describe Vulnerability do
it { is_expected.to belong_to(:updated_by).class_name('User') }
it { is_expected.to belong_to(:last_edited_by).class_name('User') }
it { is_expected.to belong_to(:resolved_by).class_name('User') }
it { is_expected.to belong_to(:closed_by).class_name('User') }
it { is_expected.to belong_to(:dismissed_by).class_name('User') }
it { is_expected.to belong_to(:confirmed_by).class_name('User') }
it { is_expected.to have_many(:findings).class_name('Vulnerabilities::Occurrence').dependent(false) }
......
......@@ -199,7 +199,7 @@ describe API::Vulnerabilities do
expect(response).to match_response_schema('public_api/v4/vulnerability', dir: 'ee')
expect(vulnerability.reload).to(
have_attributes(state: 'dismissed', closed_by: user, closed_at: be_like_time(Time.current)))
have_attributes(state: 'dismissed', dismissed_by: user, dismissed_at: be_like_time(Time.current)))
expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback
end
end
......
......@@ -26,7 +26,7 @@ describe Vulnerabilities::DismissService do
dismiss_vulnerability
expect(vulnerability.reload).to(
have_attributes(state: 'dismissed', closed_by: user, closed_at: be_like_time(Time.current)))
have_attributes(state: 'dismissed', dismissed_by: user, dismissed_at: be_like_time(Time.current)))
expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment