Fabricate records with the right attributes during fabrication.

This commit is contained in:
Guo Xiang Tan 2018-05-07 11:25:01 +08:00
parent 911f898a23
commit 77eb93ffb7

View File

@ -424,18 +424,15 @@ describe UserNotifications do
end end
it "includes a list of participants, groups first with member lists" do it "includes a list of participants, groups first with member lists" do
group1 = Fabricate(:group) group1 = Fabricate(:group, name: "group1")
group2 = Fabricate(:group) group2 = Fabricate(:group, name: "group2")
group1.name = "group1"
group2.name = "group2" user1 = Fabricate(:user, username: "one", groups: [group1, group2])
user1 = Fabricate(:user) user2 = Fabricate(:user, username: "two", groups: [group1])
user2 = Fabricate(:user)
user1.username = "one" topic.allowed_users = [user1, user2]
user2.username = "two" topic.allowed_groups = [group1, group2]
user1.groups = [ group1, group2 ]
user2.groups = [ group1 ]
topic.allowed_users = [ user1, user2 ]
topic.allowed_groups = [ group1, group2 ]
mail = UserNotifications.user_private_message( mail = UserNotifications.user_private_message(
response.user, response.user,
post: response, post: response,