Commit d260d19c authored by Albert Salim's avatar Albert Salim

Merge branch 'afontaine/fix-flaky-ff-test' into 'master'

Adjust Feature Flag Audit Test to be Flexible

See merge request gitlab-org/gitlab!69475
parents 737b51c7 a492145f
...@@ -52,8 +52,7 @@ module FeatureFlags ...@@ -52,8 +52,7 @@ module FeatureFlags
scopes = strategy.scopes scopes = strategy.scopes
.map { |scope| %Q("#{scope.environment_scope}") } .map { |scope| %Q("#{scope.environment_scope}") }
.join(', ') .join(', ')
%Q(Created strategy \"#{strategy.name}\" )\ %Q(Created strategy "#{strategy.name}" with scopes #{scopes}.)
"with scopes #{scopes}."
end end
def feature_flag_by_name def feature_flag_by_name
......
...@@ -69,15 +69,10 @@ RSpec.describe FeatureFlags::CreateService do ...@@ -69,15 +69,10 @@ RSpec.describe FeatureFlags::CreateService do
end end
it 'creates audit event' do it 'creates audit event' do
expected_message = 'Created feature flag feature_flag '\
'with description "description". '\
'Created strategy "default" with scopes '\
'"*". '\
'Created strategy "default" with scopes '\
'"production".'
expect { subject }.to change { AuditEvent.count }.by(1) expect { subject }.to change { AuditEvent.count }.by(1)
expect(AuditEvent.last.details[:custom_message]).to eq(expected_message) expect(AuditEvent.last.details[:custom_message]).to start_with('Created feature flag feature_flag with description "description".')
expect(AuditEvent.last.details[:custom_message]).to include('Created strategy "default" with scopes "*".')
expect(AuditEvent.last.details[:custom_message]).to include('Created strategy "default" with scopes "production".')
end end
context 'when user is reporter' do context 'when user is reporter' do
......
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