diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/helpers/todos_helper_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/helpers/todos_helper_spec.rb')
-rw-r--r-- | spec/helpers/todos_helper_spec.rb | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/spec/helpers/todos_helper_spec.rb b/spec/helpers/todos_helper_spec.rb index c64d5990cd9..7c91dd0570f 100644 --- a/spec/helpers/todos_helper_spec.rb +++ b/spec/helpers/todos_helper_spec.rb @@ -127,10 +127,22 @@ RSpec.describe TodosHelper do context 'when given a task' do let(:todo) { task_todo } - it 'responds with an appropriate path' do + context 'when the use_iid_in_work_items_path feature flag is disabled' do + before do + stub_feature_flags(use_iid_in_work_items_path: false) + end + + it 'responds with an appropriate path' do + path = helper.todo_target_path(todo) + + expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.id}") + end + end + + it 'responds with an appropriate path using iid' do path = helper.todo_target_path(todo) - expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.id}") + expect(path).to eq("/#{todo.project.full_path}/-/work_items/#{todo.target.iid}?iid_path=true") end end @@ -310,4 +322,33 @@ RSpec.describe TodosHelper do it { expect(helper.todos_filter_params[:state]).to eq(result) } end end + + describe '#todo_action_name' do + using RSpec::Parameterized::TableSyntax + + where(:action, :self_added?, :expected_action_name) do + Todo::ASSIGNED | false | s_('Todos|assigned you') + Todo::ASSIGNED | true | s_('Todos|assigned') + Todo::REVIEW_REQUESTED | true | s_('Todos|requested a review of') + Todo::MENTIONED | true | format(s_("Todos|mentioned %{who} on"), who: s_('Todos|yourself')) + Todo::MENTIONED | false | format(s_("Todos|mentioned %{who} on"), who: _('you')) + Todo::DIRECTLY_ADDRESSED | true | format(s_("Todos|mentioned %{who} on"), who: s_('Todos|yourself')) + Todo::DIRECTLY_ADDRESSED | false | format(s_("Todos|mentioned %{who} on"), who: _('you')) + Todo::BUILD_FAILED | true | s_('Todos|The pipeline failed in') + Todo::MARKED | true | s_('Todos|added a todo for') + Todo::APPROVAL_REQUIRED | true | format(s_("Todos|set %{who} as an approver for"), who: s_('Todos|yourself')) + Todo::APPROVAL_REQUIRED | false | format(s_("Todos|set %{who} as an approver for"), who: _('you')) + Todo::UNMERGEABLE | true | s_('Todos|Could not merge') + Todo::MERGE_TRAIN_REMOVED | true | s_("Todos|Removed from Merge Train:") + end + + with_them do + before do + alert_todo.action = action + alert_todo.user = self_added? ? alert_todo.author : user + end + + it { expect(helper.todo_action_name(alert_todo)).to eq(expected_action_name) } + end + end end |