2020-07-10 15:09:07 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Packages::Composer::VersionParserService do
|
|
|
|
let_it_be(:params) { {} }
|
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
using RSpec::Parameterized::TableSyntax
|
|
|
|
|
|
|
|
subject { described_class.new(tag_name: tagname, branch_name: branchname).execute }
|
|
|
|
|
|
|
|
where(:tagname, :branchname, :expected_version) do
|
|
|
|
nil | 'master' | 'dev-master'
|
|
|
|
nil | 'my-feature' | 'dev-my-feature'
|
2021-09-17 15:11:44 +00:00
|
|
|
nil | '12-feature' | 'dev-12-feature'
|
2020-07-10 15:09:07 +00:00
|
|
|
nil | 'v1' | '1.x-dev'
|
|
|
|
nil | 'v1.x' | '1.x-dev'
|
|
|
|
nil | 'v1.7.x' | '1.7.x-dev'
|
|
|
|
nil | 'v1.7' | '1.7.x-dev'
|
|
|
|
nil | '1.7.x' | '1.7.x-dev'
|
|
|
|
'v1.0.0' | nil | '1.0.0'
|
|
|
|
'v1.0' | nil | '1.0'
|
2020-11-04 21:08:43 +00:00
|
|
|
'v1.0.1+meta' | nil | '1.0.1+meta'
|
2020-07-10 15:09:07 +00:00
|
|
|
'1.0' | nil | '1.0'
|
|
|
|
'1.0.2' | nil | '1.0.2'
|
|
|
|
'1.0.2-beta2' | nil | '1.0.2-beta2'
|
2020-11-04 21:08:43 +00:00
|
|
|
'1.0.1+meta' | nil | '1.0.1+meta'
|
2020-07-10 15:09:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
with_them do
|
|
|
|
it { is_expected.to eq expected_version }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|