mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
disable observers in tests, enable as needed, tests are 20% faster
This commit is contained in:
@ -455,52 +455,6 @@ describe Post do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'notifications' do
|
||||
|
||||
let(:coding_horror) { Fabricate(:coding_horror) }
|
||||
|
||||
describe 'replies' do
|
||||
|
||||
let(:post) { Fabricate(:post, post_args.merge(raw: "Hello @CodingHorror")) }
|
||||
|
||||
it 'notifies the poster on reply' do
|
||||
lambda {
|
||||
@reply = Fabricate(:basic_reply, user: coding_horror, topic: post.topic)
|
||||
}.should change(post.user.notifications, :count).by(1)
|
||||
end
|
||||
|
||||
it "doesn't notify the poster when they reply to their own post" do
|
||||
lambda {
|
||||
@reply = Fabricate(:basic_reply, user: post.user, topic: post.topic)
|
||||
}.should_not change(post.user.notifications, :count).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'watching' do
|
||||
it "does notify watching users of new posts" do
|
||||
post = Fabricate(:post, post_args)
|
||||
user2 = Fabricate(:coding_horror)
|
||||
post_args[:topic].notify_watch!(user2)
|
||||
lambda {
|
||||
Fabricate(:post, user: post.user, topic: post.topic)
|
||||
}.should change(user2.notifications, :count).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'muting' do
|
||||
it "does not notify users of new posts" do
|
||||
post = Fabricate(:post, post_args)
|
||||
user = post_args[:user]
|
||||
user2 = Fabricate(:coding_horror)
|
||||
|
||||
post_args[:topic].notify_muted!(user)
|
||||
lambda {
|
||||
Fabricate(:post, user: user2, topic: post.topic, raw: 'hello @' + user.username)
|
||||
}.should change(user.notifications, :count).by(0)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'after save' do
|
||||
|
||||
|
Reference in New Issue
Block a user