FIX: Don't ever grant badges when they're disabled

This commit is contained in:
Robin Ward
2016-08-19 15:16:37 -04:00
parent b4b96bf62b
commit 4061725a95
3 changed files with 16 additions and 1 deletions

View File

@ -604,11 +604,18 @@ describe CookedPostProcessor do
before { Oneboxer.stubs(:onebox) }
it "awards a badge for using an emoji" do
it "awards a badge for using an onebox" do
cpp.post_process_oneboxes
cpp.grant_badges
expect(post.user.user_badges.where(badge_id: Badge::FirstOnebox).exists?).to eq(true)
end
it "doesn't award the badge when the badge is disabled" do
Badge.where(id: Badge::FirstOnebox).update_all(enabled: false)
cpp.post_process_oneboxes
cpp.grant_badges
expect(post.user.user_badges.where(badge_id: Badge::FirstOnebox).exists?).to eq(false)
end
end
context "reply_by_email" do