FIX: auto-message shouldn't generate notifications

This commit is contained in:
Régis Hanol
2015-03-11 19:07:17 +01:00
parent 6cd4330335
commit c8631a7a8b
4 changed files with 20 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ describe PostAction do
mod = moderator
Group.refresh_automatic_groups!
action = PostAction.act(codinghorror, post, PostActionType.types[:notify_moderators], message: "this is my special long message");
action = PostAction.act(codinghorror, post, PostActionType.types[:notify_moderators], message: "this is my special long message")
posts = Post.joins(:topic)
.select('posts.id, topics.subtype, posts.topic_id')
@@ -76,7 +76,7 @@ describe PostAction do
it "creates a pm if selected" do
post = build(:post, id: 1000)
PostCreator.any_instance.expects(:create).returns(post)
PostAction.act(build(:user), build(:post), PostActionType.types[:notify_moderators], message: "this is my special message");
PostAction.act(build(:user), build(:post), PostActionType.types[:notify_moderators], message: "this is my special message")
end
end
@@ -89,7 +89,7 @@ describe PostAction do
it "sends an email to user if selected" do
PostCreator.any_instance.expects(:create).returns(build(:post))
PostAction.act(build(:user), post, PostActionType.types[:notify_user], message: "this is my special message");
PostAction.act(build(:user), post, PostActionType.types[:notify_user], message: "this is my special message")
end
end
end
@@ -458,4 +458,18 @@ describe PostAction do
end
describe ".add_moderator_post_if_needed" do
it "should not generate a notification for auto-message" do
post = create_post
PostAction.act(moderator, post, PostActionType.types[:spam], message: "WAT")
PostAlerter.expects(:post_created).never
PostAction.agree_flags!(post, admin)
end
end
end