diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 15:14:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 15:14:34 +0300 |
commit | 26fa51816ab94df9c2f3db8c93da4d57f7bd6fc4 (patch) | |
tree | 3b29671cb4bc910500d8c7db4e2694b4c012387e /spec/models | |
parent | 6b0293c14dce817f72310127dd38562313321b1b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/member_spec.rb | 24 | ||||
-rw-r--r-- | spec/models/release_spec.rb | 19 |
2 files changed, 43 insertions, 0 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index db2ae319bc9..32303f76684 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -735,6 +735,30 @@ RSpec.describe Member, feature_category: :groups_and_projects do it { is_expected.to respond_to(:user_email) } end + describe 'callbacks' do + describe '#send_invite' do + context 'with an invited group member' do + it 'sends an invite email' do + expect_next_instance_of(NotificationService) do |instance| + expect(instance).to receive(:invite_member) + end + + create(:group_member, :invited) + end + end + + context 'with an uninvited member' do + it 'does not send an invite email' do + expect_next_instance_of(NotificationService) do |instance| + expect(instance).not_to receive(:invite_member) + end + + create(:group_member) + end + end + end + end + describe '.valid_email?' do it 'is a valid email format' do expect(described_class.valid_email?('foo')).to eq(false) diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb index bff9f73e44a..4a4cb1ae46a 100644 --- a/spec/models/release_spec.rb +++ b/spec/models/release_spec.rb @@ -156,6 +156,7 @@ RSpec.describe Release, feature_category: :release_orchestration do describe 'latest releases' do let_it_be(:yesterday) { Time.zone.now - 1.day } + let_it_be(:today) { Time.zone.now } let_it_be(:tomorrow) { Time.zone.now + 1.day } let_it_be(:project2) { create(:project) } @@ -176,6 +177,14 @@ RSpec.describe Release, feature_category: :release_orchestration do create(:release, project: project2, released_at: tomorrow, created_at: yesterday) end + let_it_be(:project2_release3) do + create(:release, project: project2, released_at: today, created_at: yesterday) + end + + let_it_be(:project2_release4) do + create(:release, project: project2, released_at: today, created_at: yesterday, release_published_at: today) + end + let(:args) { {} } describe '.latest' do @@ -240,6 +249,16 @@ RSpec.describe Release, feature_category: :release_orchestration do end end end + + describe '.waiting_for_publish_event' do + let(:releases) { [project2_release3] } + + subject(:waiting) { described_class.waiting_for_publish_event } + + it "find today's releases not yet published" do + expect(waiting).to match_array(releases) + end + end end describe '#assets_count' do |