blob: faede7a361ff3ed33f98aee0ec58166dbf15d203 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Ci::Build::Rules::Rule::Clause do
describe '.fabricate' do
using RSpec::Parameterized::TableSyntax
let(:value) { 'some value' }
subject { described_class.fabricate(type, value) }
context 'when type is valid' do
where(:type, :result) do
'changes' | Gitlab::Ci::Build::Rules::Rule::Clause::Changes
'exists' | Gitlab::Ci::Build::Rules::Rule::Clause::Exists
'if' | Gitlab::Ci::Build::Rules::Rule::Clause::If
end
with_them do
it { is_expected.to be_instance_of(result) }
end
end
context 'when type is invalid' do
let(:type) { 'when' }
it { is_expected.to be_nil }
context "when type is 'variables'" do
let(:type) { 'variables' }
it { is_expected.to be_nil }
end
end
end
end
|