2019-10-17 11:06:17 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Releases::Evidence do
|
2019-10-17 11:06:17 -04:00
|
|
|
let_it_be(:project) { create(:project) }
|
2021-04-21 05:09:15 -04:00
|
|
|
|
2019-10-17 11:06:17 -04:00
|
|
|
let(:release) { create(:release, project: project) }
|
|
|
|
|
|
|
|
describe 'associations' do
|
|
|
|
it { is_expected.to belong_to(:release) }
|
|
|
|
end
|
|
|
|
|
2020-06-02 14:08:32 -04:00
|
|
|
it 'filters out issues from summary json' do
|
|
|
|
milestone = create(:milestone, project: project, due_date: nil)
|
|
|
|
issue = create(:issue, project: project, description: nil, state: 'closed')
|
|
|
|
milestone.issues << issue
|
|
|
|
release.milestones << milestone
|
2019-10-17 11:06:17 -04:00
|
|
|
|
2020-06-02 14:08:32 -04:00
|
|
|
::Releases::CreateEvidenceService.new(release).execute
|
|
|
|
evidence = release.evidences.last
|
2019-10-17 11:06:17 -04:00
|
|
|
|
2020-06-02 14:08:32 -04:00
|
|
|
expect(evidence.read_attribute(:summary)["release"]["milestones"].first["issues"].first["title"]).to be_present
|
|
|
|
expect(evidence.summary["release"]["milestones"].first["issues"]).to be_nil
|
2019-10-17 11:06:17 -04:00
|
|
|
end
|
|
|
|
end
|