Skip to content

Commit 8f2d018

Browse files
committed
expanded potential spam profiles job test to check that the job actually works as expected
1 parent 6fbe70d commit 8f2d018

4 files changed

Lines changed: 32 additions & 0 deletions

File tree

test/fixtures/community_users.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,10 @@ sample_enabled_2fa:
9898
is_admin: false
9999
is_moderator: false
100100
reputation: 1
101+
102+
sample_spammer:
103+
user: spammer
104+
community: sample
105+
is_admin: false
106+
is_moderator: false
107+
reputation: 1

test/fixtures/user_abilities.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ e2_ep_susp:
7272
is_suspended: true
7373
suspension_end: ~
7474
suspension_message: go away
75+
76+
e_sp:
77+
community_user: sample_spammer
78+
ability: unrestricted

test/fixtures/users.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,18 @@ enabled_2fa:
148148
enabled_2fa: true
149149
two_factor_token: WT65ANYXBB2SBR7III7IVWNJDS4PQF2T
150150
backup_2fa_code: M8lENyehyCvo9F9MbyTl1aOL
151+
152+
spammer:
153+
email: spammer@example.com
154+
encrypted_password: '$2a$11$roUHXKxecjyQ72Qn7DWs3.9eRCCoRn176kX/UNb/xiue3aGqf7xEW'
155+
profile: >
156+
Find the best spam on the network <a href="https://example.com">here</a>!
157+
The yummiest spam you've ever tasted.
158+
profile_markdown: >
159+
Find the best spam on the network [here](https://example.com)!
160+
The yummiest spam you've ever tasted.
161+
sign_in_count: 1
162+
username: BestSpamOnTheNet
163+
is_global_admin: false
164+
is_global_moderator: false
165+
confirmed_at: 2020-01-01T00:00:00.000000Z

test/jobs/potential_spam_profiles_job_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
class PotentialSpamProfilesJobTest < ActiveJob::TestCase
44
test 'should run job successfully' do
5+
unrestricted_id = abilities(:unrestricted).internal_id
6+
7+
assert users(:spammer).community_user.ability?(unrestricted_id)
8+
59
perform_enqueued_jobs do
610
PotentialSpamProfilesJob.perform_later
711
end
12+
813
assert_performed_jobs 1
14+
assert_not users(:spammer).community_user.ability?(unrestricted_id)
915
end
1016
end

0 commit comments

Comments
 (0)