diff --git a/spec/mailers/invite_mailer_spec.rb b/spec/mailers/invite_mailer_spec.rb index 4bf13fddfda..dc1b60fe307 100644 --- a/spec/mailers/invite_mailer_spec.rb +++ b/spec/mailers/invite_mailer_spec.rb @@ -78,7 +78,11 @@ describe InviteMailer do let(:topic) { Fabricate(:topic, excerpt: "Topic invite support is now available in Discourse!", user: trust_level_2) } context "default invite message" do - let(:invite) { topic.invite(topic.user, 'name@example.com') } + let(:invite) do + topic.invite(topic.user, 'name@example.com') + Invite.find_by(invited_by_id: topic.user.id) + end + let(:invite_mail) { InviteMailer.send_invite(invite) } it 'renders the invitee email' do @@ -123,7 +127,16 @@ describe InviteMailer do end context "custom invite message" do - let(:invite) { topic.invite(topic.user, 'name@example.com', nil, "Hey, I thought you might enjoy this topic!") } + let(:invite) do + topic.invite( + topic.user, + 'name@example.com', + nil, + "Hey, I thought you might enjoy this topic!" + ) + + Invite.find_by(invited_by_id: topic.user.id) + end let(:custom_invite_mail) { InviteMailer.send_invite(invite) } it 'renders custom_message' do diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb index c72ef714ed2..78e6d2c4db1 100644 --- a/spec/models/invite_spec.rb +++ b/spec/models/invite_spec.rb @@ -329,9 +329,11 @@ describe Invite do context 'invited to topics' do let(:tl2_user) { Fabricate(:user, trust_level: 2) } let!(:topic) { Fabricate(:private_message_topic, user: tl2_user) } - let!(:invite) { + + let!(:invite) do topic.invite(topic.user, 'jake@adventuretime.ooo') - } + Invite.find_by(invited_by_id: topic.user) + end context 'redeem topic invite' do it 'adds the user to the topic_users' do