Commit 84df5586de29875ebe03b36b2f2d3df8a0d4f934
1 parent
7a7d4ce0
Exists in
master
and in
29 other branches
Fix AbuseComplaint unit tests
Showing
1 changed file
with
13 additions
and
4 deletions
Show diff stats
test/unit/abuse_complaint_test.rb
... | ... | @@ -7,7 +7,7 @@ class AbuseComplaintTest < ActiveSupport::TestCase |
7 | 7 | abuse_complaint = AbuseComplaint.new |
8 | 8 | |
9 | 9 | assert !abuse_complaint.valid? |
10 | - assert abuse_complaint.errors.invalid?(:reported) | |
10 | + assert abuse_complaint.errors[:reported].any? | |
11 | 11 | |
12 | 12 | abuse_complaint.reported = reported |
13 | 13 | |
... | ... | @@ -24,9 +24,18 @@ class AbuseComplaintTest < ActiveSupport::TestCase |
24 | 24 | assert_equal Task::Status::HIDDEN, abuse_complaint.status |
25 | 25 | |
26 | 26 | reported.environment.stubs(:reports_lower_bound).returns(2) |
27 | - r1 = AbuseReport.create!(:reporter => p1, :abuse_complaint => abuse_complaint, :reason => 'some reason') | |
28 | - r2 = AbuseReport.create!(:reporter => p2, :abuse_complaint => abuse_complaint, :reason => 'some reason') | |
29 | - r3 = AbuseReport.create!(:reporter => p3, :abuse_complaint => abuse_complaint, :reason => 'some reason') | |
27 | + r1 = AbuseReport.new(:reason => 'some reason').tap do |a| | |
28 | + a.reporter = p1 | |
29 | + a.abuse_complaint = abuse_complaint | |
30 | + end.save | |
31 | + r2 = AbuseReport.new(:reason => 'some reason').tap do |a| | |
32 | + a.reporter = p2 | |
33 | + a.abuse_complaint = abuse_complaint | |
34 | + end.save | |
35 | + r3 = AbuseReport.new(:reason => 'some reason').tap do |a| | |
36 | + a.reporter = p3 | |
37 | + a.abuse_complaint = abuse_complaint | |
38 | + end.save | |
30 | 39 | |
31 | 40 | assert_equal Task::Status::ACTIVE, abuse_complaint.status |
32 | 41 | end | ... | ... |