diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-31 12:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-31 12:08:57 +0300 |
commit | b46d41d54b05eab84bb9653c111124b67f573dd8 (patch) | |
tree | d93565ff482acf086904dc96e5718143e69b9174 /spec/models | |
parent | 8d15913bc406fea50faf8f80abf129e2e9a5f847 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/member_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 067b3c25645..3f7f69ff34e 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -645,6 +645,16 @@ RSpec.describe Member do expect(user.authorized_projects.reload).to include(project) end + + it 'does not accept the invite if saving a new user fails' do + invalid_user = User.new(first_name: '', last_name: '') + + member.accept_invite! invalid_user + + expect(member.invite_accepted_at).to be_nil + expect(member.invite_token).not_to be_nil + expect_any_instance_of(Member).not_to receive(:after_accept_invite) + end end describe "#decline_invite!" do diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index e26355b1eb4..a2b818576a6 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -1576,6 +1576,14 @@ RSpec.describe Note do expect(note.post_processed_cache_key).to eq("#{note.cache_key}:#{note.author.cache_key}") end + context 'when note has no author' do + let(:note) { build(:note, author: nil) } + + it 'returns cache key only' do + expect(note.post_processed_cache_key).to eq("#{note.cache_key}:") + end + end + context 'when note has redacted_note_html' do let(:redacted_note_html) { 'redacted note html' } |