From 77eb93ffb792a2ee1fbef90f4331538feb80597b Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 7 May 2018 11:25:01 +0800 Subject: [PATCH] Fabricate records with the right attributes during fabrication. --- spec/mailers/user_notifications_spec.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rb index 322b643cf6f..bb8118d499f 100644 --- a/spec/mailers/user_notifications_spec.rb +++ b/spec/mailers/user_notifications_spec.rb @@ -424,18 +424,15 @@ describe UserNotifications do end it "includes a list of participants, groups first with member lists" do - group1 = Fabricate(:group) - group2 = Fabricate(:group) - group1.name = "group1" - group2.name = "group2" - user1 = Fabricate(:user) - user2 = Fabricate(:user) - user1.username = "one" - user2.username = "two" - user1.groups = [ group1, group2 ] - user2.groups = [ group1 ] - topic.allowed_users = [ user1, user2 ] - topic.allowed_groups = [ group1, group2 ] + group1 = Fabricate(:group, name: "group1") + group2 = Fabricate(:group, name: "group2") + + user1 = Fabricate(:user, username: "one", groups: [group1, group2]) + user2 = Fabricate(:user, username: "two", groups: [group1]) + + topic.allowed_users = [user1, user2] + topic.allowed_groups = [group1, group2] + mail = UserNotifications.user_private_message( response.user, post: response,