diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/helpers/events_helper_spec.rb | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/helpers/events_helper_spec.rb')
-rw-r--r-- | spec/helpers/events_helper_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/helpers/events_helper_spec.rb b/spec/helpers/events_helper_spec.rb index cc6804f0355..7005b3dc53e 100644 --- a/spec/helpers/events_helper_spec.rb +++ b/spec/helpers/events_helper_spec.rb @@ -24,6 +24,45 @@ RSpec.describe EventsHelper do end end + describe '#localized_action_name' do + it 'handles all valid design events' do + created, updated, destroyed = %i[created updated destroyed].map do |trait| + event = build(:design_event, trait) + helper.localized_action_name(event) + end + + expect(created).to eq(_('added')) + expect(updated).to eq(_('updated')) + expect(destroyed).to eq(_('removed')) + end + + context 'handles correct base actions' do + using RSpec::Parameterized::TableSyntax + + where(:trait, :localized_action_name) do + :created | s_('Event|created') + :updated | s_('Event|opened') + :closed | s_('Event|closed') + :reopened | s_('Event|opened') + :commented | s_('Event|commented on') + :merged | s_('Event|accepted') + :joined | s_('Event|joined') + :left | s_('Event|left') + :destroyed | s_('Event|destroyed') + :expired | s_('Event|removed due to membership expiration from') + :approved | s_('Event|approved') + end + + with_them do + it 'with correct name and method' do + event = build(:event, trait) + + expect(helper.localized_action_name(event)).to eq(localized_action_name) + end + end + end + end + describe '#event_commit_title' do let(:message) { 'foo & bar ' + 'A' * 70 + '\n' + 'B' * 80 } |