Skip to content

Commit bb5d7af

Browse files
committed
Use more realistic source examples in tests
1 parent 8def6ca commit bb5d7af

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

spec/models/file_review_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
file_review = FileReview.new
1313
violation_message = "violation found!"
1414

15-
file_review.build_violation(line, violation_message, "debugger")
15+
file_review.build_violation(line, violation_message, "foo = bar(1, 2)")
1616
violation = file_review.violations.first
1717

1818
expect(file_review.violations.size).to eq 1
1919
expect(violation.patch_position).to eq line.patch_position
2020
expect(violation.line_number).to eq line.number
2121
expect(violation.messages).to eq [violation_message]
22-
expect(violation.source).to eq "debugger"
22+
expect(violation.source).to eq "foo = bar(1, 2)"
2323
end
2424
end
2525

@@ -28,7 +28,7 @@
2828
line = build_line(changed: false)
2929
file_review = FileReview.new
3030

31-
file_review.build_violation(line, "hello", "debugger")
31+
file_review.build_violation(line, "hello", "foo = bar(1, 2)")
3232

3333
expect(file_review.violations).to be_empty
3434
end
@@ -41,8 +41,8 @@
4141
line = build_line
4242
file_review = FileReview.new
4343

44-
file_review.build_violation(line, first_violation_message, "debugger")
45-
file_review.build_violation(line, other_violation_message, "debugger")
44+
file_review.build_violation(line, first_violation_message, "foo = bar(1, 2)")
45+
file_review.build_violation(line, other_violation_message, "foo = bar(1, 2)")
4646
violation = file_review.violations.first
4747

4848
expect(file_review.violations.size).to eq 1

spec/requests/builds_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
existing_comment_violation = {
1616
line: 5,
1717
message: "Line is too long.",
18-
source: "debugger",
18+
source: "foo = 'bbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr';",
1919
}
2020
new_violation1 = {
2121
line: 3,
22-
message: "Trailing whitespace detected.",
23-
source: "debugger",
22+
message: "Avoid empty else-clauses.",
23+
source: "else {}",
2424
}
2525
new_violation2 = {
2626
line: 9,
2727
message: "Avoid empty else-clauses.",
28-
source: "debugger",
28+
source: "else {}",
2929
}
3030
violations = [new_violation1, existing_comment_violation, new_violation2]
3131
create(:repo, :active, github_id: repo_id, name: repo_name)

spec/services/complete_file_review_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def attributes
6363
commit_sha: "abc123",
6464
pull_request_number: 123,
6565
patch: File.read("spec/support/fixtures/patch.diff"),
66-
violations: [line: 14, message: "woohoo", source: "debugger"],
66+
violations: [line: 14, message: "woohoo", source: "foo = bar(1, 2)"],
6767
error: "Your linter config is invalid",
6868
}
6969
end

0 commit comments

Comments
 (0)