mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
6e161d3e75
The most common thing that we do with fab! is: fab!(:thing) { Fabricate(:thing) } This commit adds a shorthand for this which is just simply: fab!(:thing) i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
23 lines
710 B
Ruby
23 lines
710 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ::Jobs::NotifyCategoryChange do
|
|
fab!(:user)
|
|
fab!(:regular_user) { Fabricate(:trust_level_4) }
|
|
fab!(:post) { Fabricate(:post, user: regular_user) }
|
|
fab!(:category) { Fabricate(:category, name: "test") }
|
|
|
|
it "doesn't create notification for the editor who watches new tag" do
|
|
CategoryUser.set_notification_level_for_category(
|
|
user,
|
|
CategoryUser.notification_levels[:watching_first_post],
|
|
category.id,
|
|
)
|
|
post.topic.update!(category: category)
|
|
post.update!(last_editor_id: user.id)
|
|
|
|
expect { described_class.new.execute(post_id: post.id, notified_user_ids: []) }.not_to change {
|
|
Notification.count
|
|
}
|
|
end
|
|
end
|