# frozen_string_literal: true

require 'spec_helper'

describe ReleaseTools::Project::Gitaly do
  it_behaves_like 'project .auto_deploy_path'
  it_behaves_like 'project .canonical_or_security_path'
  it_behaves_like 'project .remotes'
  it_behaves_like 'project .security_group'
  it_behaves_like 'project .security_path', 'gitlab-org/security/gitaly'
  it_behaves_like 'project .to_s'
  it_behaves_like 'project IDs'

  describe '.path' do
    it { expect(described_class.path).to eq 'gitlab-org/gitaly' }
  end

  describe '.dev_path' do
    it { expect(described_class.dev_path).to eq 'gitlab/gitaly' }
  end

  describe '.group' do
    it { expect(described_class.group).to eq 'gitlab-org' }
  end

  describe '.dev_group' do
    it { expect(described_class.dev_group).to eq 'gitlab' }
  end

  describe '.version_file' do
    it { expect(described_class.version_file).to eq 'GITALY_SERVER_VERSION' }
  end

  describe '.metadata_project_name' do
    it { expect(described_class.metadata_project_name).to eq('gitaly') }
  end

  describe '.ee_branch?' do
    it { expect(described_class).not_to be_ee_branch }
  end

  describe '.ee_tag?' do
    it { expect(described_class).not_to be_ee_tag }
  end

  describe '.tag_for' do
    it 'returns the tag for the specific version' do
      version = ReleaseTools::Version.new('15.5.4')

      expect(described_class.tag_for(version)).to eq('v15.5.4')
    end
  end

  describe '.stable_branch_for' do
    it 'returns the stable branch for the specific version' do
      version = ReleaseTools::Version.new('15.5.4')

      expect(described_class.stable_branch_for(version)).to eq('15-5-stable')
    end
  end
end
