Commit 746c9b10 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'fix-dast-site-profile-method-return-type-273078' into 'master'

Fix return type of DastSiteProfile#status

See merge request gitlab-org/gitlab!46180
parents 15155949 ed6327ef
# frozen_string_literal: true
class DastSiteValidation < ApplicationRecord
HEADER = 'Gitlab-On-Demand-DAST'.freeze
HEADER = 'Gitlab-On-Demand-DAST'
belongs_to :dast_site_token
has_many :dast_sites
......@@ -27,9 +27,9 @@ class DastSiteValidation < ApplicationRecord
"#{url_base}/#{url_path}"
end
INITIAL_STATE = :pending
INITIAL_STATE = 'pending'
state_machine :state, initial: INITIAL_STATE do
state_machine :state, initial: INITIAL_STATE.to_sym do
event :start do
transition pending: :inprogress
end
......
......@@ -44,7 +44,7 @@ module DastSiteTokens
end
def calculate_status(dast_site_validation)
dast_site_validation&.state || DastSiteValidation::INITIAL_STATE.to_s
dast_site_validation&.state || DastSiteValidation::INITIAL_STATE
end
end
end
---
title: Fix return type of DastSiteProfile#status
merge_request: 46180
author:
type: fixed
......@@ -79,7 +79,7 @@ RSpec.describe DastSiteProfile, type: :model do
aggregate_failures do
expect(subject.dast_site_validation).to be_nil
expect(subject.status).to eq(:pending)
expect(subject.status).to eq('pending')
end
end
end
......
......@@ -98,5 +98,13 @@ RSpec.describe 'Query.project(fullPath).dastSiteProfile' do
expect(dast_site_profile_response).to be_nil
end
end
context 'when there is no associated dast_site_validation' do
it 'returns a pending validation status' do
dast_site_profile.dast_site_validation.destroy!
expect(dast_site_profile_response['validationStatus']).to eq('PENDING_VALIDATION')
end
end
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