Commit 3730b067 authored by Etienne Baqué's avatar Etienne Baqué

Simplified AuditEventsHelper module and related rspec

parent 2dcf50da
......@@ -2,7 +2,7 @@
module AuditEventsHelper
def human_text(details)
return custom_message_for(details) if details[:custom_message]
return details[:custom_message] if details[:custom_message]
details.map { |key, value| select_keys(key, value) }.join(" ").humanize
end
......@@ -14,10 +14,4 @@ module AuditEventsHelper
"#{key} <strong>#{value}</strong>"
end
end
def custom_message_for(details)
target_type = details[:target_type]
val = details[:custom_message]
target_type == 'Operations::FeatureFlag' ? val : val.tr('_', ' ')
end
end
......@@ -30,15 +30,6 @@ describe AuditEventsHelper do
it 'returns custom message' do
expect(subject).to eq(custom_message)
end
context 'when message relates to feature flags' do
let(:custom_message) { "Feature flag my_feature_flag was updated" }
let(:target_type) { 'Operations::FeatureFlag' }
it 'shows message as is' do
is_expected.to eq(custom_message)
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