diff options
Diffstat (limited to 'spec/helpers/todos_helper_spec.rb')
-rw-r--r-- | spec/helpers/todos_helper_spec.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/helpers/todos_helper_spec.rb b/spec/helpers/todos_helper_spec.rb index ca334a04fe9..fcdb41eb4af 100644 --- a/spec/helpers/todos_helper_spec.rb +++ b/spec/helpers/todos_helper_spec.rb @@ -43,6 +43,10 @@ RSpec.describe TodosHelper do create(:todo, target: group) end + let_it_be(:project_access_request_todo) do + create(:todo, target: project, action: Todo::MEMBER_ACCESS_REQUESTED) + end + describe '#todos_count_format' do it 'shows fuzzy count for 100 or more items' do expect(helper.todos_count_format(100)).to eq '99+' @@ -172,7 +176,17 @@ RSpec.describe TodosHelper do it 'responds with access requests tab' do path = helper.todo_target_path(group_access_request_todo) - access_request_path = Gitlab::Routing.url_helpers.group_group_members_url(group, tab: 'access_requests') + access_request_path = Gitlab::Routing.url_helpers.group_group_members_path(group, tab: 'access_requests') + + expect(path).to eq(access_request_path) + end + end + + context 'when a user requests access to project' do + it 'responds with access requests tab' do + path = helper.todo_target_path(project_access_request_todo) + + access_request_path = Gitlab::Routing.url_helpers.project_project_members_path(project, tab: 'access_requests') expect(path).to eq(access_request_path) end @@ -374,7 +388,7 @@ RSpec.describe TodosHelper do end context 'member access requested' do - context 'when source is group' do + context 'when target is group' do it 'returns group access message' do group_todo.action = Todo::MEMBER_ACCESS_REQUESTED @@ -383,6 +397,14 @@ RSpec.describe TodosHelper do ) end end + + context 'when target is project' do + it 'returns project access message' do + expect(helper.todo_action_name(project_access_request_todo)).to eq( + format(s_("Todos|has requested access to project %{which}"), which: _(project.name)) + ) + end + end end end |