Commit 8b029c11 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '35130-jira-connect-integration-fails-for-branches-with-slashes' into 'master'

Resolve "Jira Connect integration fails for branches with slashes"

See merge request gitlab-org/gitlab!19308
parents 6bb7fffc 6f9665f2
......@@ -4,7 +4,9 @@ module Atlassian
module JiraConnect
module Serializers
class BranchEntity < BaseEntity
expose :name, as: :id
expose :id do |branch|
Digest::SHA256.hexdigest(branch.name)
end
expose :issueKeys do |branch|
JiraIssueKeyExtractor.new(branch.name).issue_keys
end
......
# frozen_string_literal: true
require 'spec_helper'
describe Atlassian::JiraConnect::Serializers::BranchEntity do
let(:project) { create(:project, :repository) }
let(:branch) { project.repository.find_branch('improve/awesome') }
subject { described_class.represent(branch, project: project).as_json }
it 'sets the hash of the branch name as the id' do
expect(subject[:id]).to eq('bbfba9b197ace5da93d03382a7ce50081ae89d99faac1f2326566941288871ce')
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