FIX: If a category of a topic changed, watching/tracking didn't kick in

This commit is contained in:
Robin Ward
2015-03-04 13:39:17 -05:00
parent 93b43c5237
commit c4fa75918b
2 changed files with 15 additions and 0 deletions

View File

@ -49,7 +49,20 @@ describe CategoryUser do
tu = TopicUser.get(tracked_post.topic, user)
expect(tu.notification_level).to eq TopicUser.notification_levels[:tracking]
expect(tu.notifications_reason_id).to eq TopicUser.notification_reasons[:auto_track_category]
end
it "watches categories that have been changed" do
watched_category = Fabricate(:category)
user = Fabricate(:user)
CategoryUser.create!(user: user, category: watched_category, notification_level: CategoryUser.notification_levels[:watching])
post = create_post
TopicUser.get(post.topic, user).should be_blank
# Now, change the topic's category
post.topic.change_category_to_id(watched_category.id)
tu = TopicUser.get(post.topic, user)
expect(tu.notification_level).to eq TopicUser.notification_levels[:watching]
end
end