Commit 7098c3a8 authored by Kamil Trzciński's avatar Kamil Trzciński

First round of spec updates

parent 65891560
......@@ -35,7 +35,7 @@ module EE
override :tab_ability_map
def tab_ability_map
tab_ability_map = super
tab_ability_map[:feature_flags] = read_feature_flags
tab_ability_map[:feature_flags] = :read_feature_flags
tab_ability_map
end
......
FactoryBot.define do
factory :operations_feature_flag, class: Operations::FeatureFlag do
sequence(:name) { |n| "feature_flag_#{n}" }
project
active true
end
end
FactoryBot.define do
factory :operations_feature_flags_access_token, class: Operations::FeatureFlagsAccessToken do
project
end
end
......@@ -9,4 +9,14 @@ describe Gitlab::Regex do
it { is_expected.to match('foo*Z') }
it { is_expected.not_to match('!!()()') }
end
describe '.feature_flag_regex' do
subject { described_class.feature_flag_regex }
it { is_expected.to match('foo') }
it { is_expected.to match('f_feature_flag') }
it { is_expected.not_to match('MY_FEATURE_FLAG') }
it { is_expected.not_to match('my feature flag') }
it { is_expected.not_to match('!!()()') }
end
end
......@@ -1767,4 +1767,24 @@ describe Project do
.and_return(ref)
end
end
describe '#feature_flag_access_token' do
let(:project) { create(:project) }
subject { project.feature_flag_access_token }
context 'when there is no access token' do
it "creates a new one" do
is_expected.not_to be_empty
end
end
context 'when there is access token' do
let!(:access_token) { create(:operations_feature_flags_access_token, project: project, token: 'token') }
it "provides an existing one" do
is_expected.to eq('token')
end
end
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