Commit f2b624e5 authored by James Lopez's avatar James Lopez

fix details and details spec

parent bbecfdfc
...@@ -32,7 +32,14 @@ module Audit ...@@ -32,7 +32,14 @@ module Audit
when :failed_login when :failed_login
"Failed to login with #{Gitlab::OAuth::Provider.label_for(value).upcase} authentication" "Failed to login with #{Gitlab::OAuth::Provider.label_for(value).upcase} authentication"
else else
"Changed #{value} from #{@details[:from]} to #{@details[:to]}" text_for_change(value)
end
end
def text_for_change(value)
"Changed #{value}".tap do |changed_string|
changed_string << " from #{@details[:from]}" if @details[:from]
changed_string << " to #{@details[:to]}" if @details[:to]
end end
end end
end end
......
...@@ -75,5 +75,23 @@ describe Audit::Details do ...@@ -75,5 +75,23 @@ describe Audit::Details do
expect(described_class.humanize(removal_action)).to eq('Removed deploy key') expect(described_class.humanize(removal_action)).to eq('Removed deploy key')
end end
end end
context 'change email' do
let(:action) do
{
change: 'email',
from: 'a@b.com',
to: 'c@b.com',
author_name: 'author',
target_id: '',
target_type: 'Email',
target_details: 'Email'
}
end
it 'humanizes the removal action' do
expect(described_class.humanize(action)).to eq('Removed deploy key')
end
end
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