diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 15:07:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 15:07:29 +0300 |
commit | 597d5ed08988cb00681eaf252d04ebae4bd24731 (patch) | |
tree | fa6c90ecda00858be51b790dad9e4d9098d29fdb /spec/services | |
parent | e2cf652edb5e9d9fa9a081952070074c07bf651e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/members/update_service_spec.rb | 37 | ||||
-rw-r--r-- | spec/services/ml/find_or_create_model_version_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/notification_service_spec.rb | 21 |
3 files changed, 59 insertions, 1 deletions
diff --git a/spec/services/members/update_service_spec.rb b/spec/services/members/update_service_spec.rb index 1c4b1abcfdb..3860543a85e 100644 --- a/spec/services/members/update_service_spec.rb +++ b/spec/services/members/update_service_spec.rb @@ -219,6 +219,25 @@ RSpec.describe Members::UpdateService, feature_category: :groups_and_projects do end end end + + context 'when project members expiration date is updated with expiry_notified_at' do + let_it_be(:params) { { expires_at: 20.days.from_now } } + + before do + group_project.group.add_owner(current_user) + members.each do |member| + member.update!(expiry_notified_at: Date.today) + end + end + + it "clear expiry_notified_at" do + subject + + members.each do |member| + expect(member.reload.expiry_notified_at).to be_nil + end + end + end end shared_examples 'updating a group' do @@ -250,6 +269,24 @@ RSpec.describe Members::UpdateService, feature_category: :groups_and_projects do subject end end + + context 'when group members expiration date is updated with expiry_notified_at' do + let_it_be(:params) { { expires_at: 20.days.from_now } } + + before do + members.each do |member| + member.update!(expiry_notified_at: Date.today) + end + end + + it "clear expiry_notified_at" do + subject + + members.each do |member| + expect(member.reload.expiry_notified_at).to be_nil + end + end + end end subject { update_service.execute(members, permission: permission) } diff --git a/spec/services/ml/find_or_create_model_version_service_spec.rb b/spec/services/ml/find_or_create_model_version_service_spec.rb index 5c29a3430d8..1211a9b1165 100644 --- a/spec/services/ml/find_or_create_model_version_service_spec.rb +++ b/spec/services/ml/find_or_create_model_version_service_spec.rb @@ -33,7 +33,7 @@ RSpec.describe ::Ml::FindOrCreateModelVersionService, feature_category: :mlops d context 'when model version does not exist' do let(:project) { existing_version.project } let(:name) { 'a_new_model' } - let(:version) { 'a_new_version' } + let(:version) { '2.0.0' } let(:package) { create(:ml_model_package, project: project, name: name, version: version) } diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 1d1dd045a09..d3cc367649f 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -3380,6 +3380,27 @@ RSpec.describe NotificationService, :mailer, feature_category: :team_planning do end end + describe '#member_about_to_expire' do + let_it_be(:group_member) { create(:group_member, expires_at: 7.days.from_now.to_date) } + let_it_be(:project_member) { create(:project_member, expires_at: 7.days.from_now.to_date) } + + context "with group member" do + it 'emails the user that their group membership will be expired' do + notification.member_about_to_expire(group_member) + + should_email(group_member.user) + end + end + + context "with project member" do + it 'emails the user that their project membership will be expired' do + notification.member_about_to_expire(project_member) + + should_email(project_member.user) + end + end + end + def create_member! create(:project_member, user: added_user, project: project) end |