We can do a lot less work in the test since we eased the criteria

This commit is contained in:
Robin Ward 2017-04-03 12:15:24 -04:00
parent dc5a6e7cda
commit b189486fc0
1 changed files with 2 additions and 19 deletions

View File

@ -9,8 +9,6 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
user = Fabricate(:user, created_at: 1.week.ago)
p = Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
old_user = Fabricate(:user, created_at: 6.months.ago)
PostAction.act(old_user, p, PostActionType.types[:like])
@ -26,9 +24,6 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
it "doesn't award it to accounts over a month old" do
user = Fabricate(:user, created_at: 2.months.ago)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
expect(granter.scores.keys).not_to include(user.id)
end
@ -36,8 +31,6 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
user = Fabricate(:user, created_at: 1.week.ago)
p = Fabricate(:post, user: user)
Fabricate(:post, topic_id: p.topic_id, user: user)
Fabricate(:post, topic_id: p.topic_id, user: user)
Fabricate(:post, topic_id: p.topic_id, user: user)
expect(granter.scores.keys).not_to include(user.id)
end
@ -45,8 +38,6 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
user = Fabricate(:user, created_at: 1.week.ago)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
expect(granter.scores.keys).to include(user.id)
end
@ -54,8 +45,6 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
user = Fabricate(:user, created_at: 1.week.ago)
p = Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
Fabricate(:post, user: user)
new_user = Fabricate(:user, created_at: 2.days.ago)
med_user = Fabricate(:user, created_at: 3.weeks.ago)
@ -64,11 +53,11 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
PostAction.act(new_user, p, PostActionType.types[:like])
PostAction.act(med_user, p, PostActionType.types[:like])
PostAction.act(old_user, p, PostActionType.types[:like])
expect(granter.scores[user.id]).to eq(0.1875)
expect(granter.scores[user.id]).to eq(0.375)
# It goes down the more they post
Fabricate(:post, user: user)
expect(granter.scores[user.id]).to eq(0.15)
expect(granter.scores[user.id]).to eq(0.25)
end
it "is limited to two accounts" do
@ -76,16 +65,10 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
u2 = Fabricate(:user, created_at: 2.weeks.ago)
u3 = Fabricate(:user, created_at: 3.weeks.ago)
Fabricate(:post, user: u1)
Fabricate(:post, user: u1)
Fabricate(:post, user: u1)
Fabricate(:post, user: u1)
Fabricate(:post, user: u2)
Fabricate(:post, user: u2)
Fabricate(:post, user: u2)
Fabricate(:post, user: u2)
Fabricate(:post, user: u3)
Fabricate(:post, user: u3)
Fabricate(:post, user: u3)
Fabricate(:post, user: u3)