diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/features/dashboard/todos/todos_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/features/dashboard/todos/todos_spec.rb')
-rw-r--r-- | spec/features/dashboard/todos/todos_spec.rb | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index 606bc82a7bb..59bb1a452c9 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -15,6 +15,8 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do project.add_developer(user) end + it_behaves_like 'a dashboard page with sidebar', :dashboard_todos_path, :todos + context 'User does not have todos' do before do sign_in(user) @@ -152,6 +154,22 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do it_behaves_like 'deleting the todo' it_behaves_like 'deleting and restoring the todo' end + + context 'when todo has a note' do + let(:note) { create(:note, project: project, note: "Check out stuff", noteable: create(:issue, project: project)) } + let!(:todo) { create(:todo, :mentioned, user: user, project: project, author: author, note: note, target: note.noteable) } + + before do + sign_in(user) + visit dashboard_todos_path + end + + it 'shows note preview' do + expect(page).to have_no_content('mentioned you:') + expect(page).to have_no_content('"Check out stuff"') + expect(page).to have_content('Check out stuff') + end + end end context 'User created todos for themself' do @@ -446,27 +464,30 @@ RSpec.describe 'Dashboard Todos', feature_category: :team_planning do end end - context 'User has a todo for an access requested raised for group membership' do - let_it_be(:group) { create(:group, :public) } + context 'User requested access' do + shared_examples 'has todo present with access request content' do + specify do + create(:todo, :member_access_requested, + user: user, + target: target, + author: author + ) + target.add_owner(user) - let_it_be(:todo) do - create(:todo, :member_access_requested, - user: user, - target: group, - author: author, - group: group) - end - - before do - group.add_owner(user) - sign_in(user) + sign_in(user) + visit dashboard_todos_path - visit dashboard_todos_path + expect(page).to have_selector('.todos-list .todo', count: 1) + expect(page).to have_content "#{author.name} has requested access to #{target.class.name.downcase} #{target.name}" + end end - it 'has todo present with access request content' do - expect(page).to have_selector('.todos-list .todo', count: 1) - expect(page).to have_content "#{author.name} has requested access to group #{group.name}" + context 'when user requests access to project or group' do + %i[project group].each do |target_type| + it_behaves_like 'has todo present with access request content' do + let_it_be(:target) { create(target_type, :public) } + end + end end end end |