Skip to content

Commit

Permalink
Use more realistic source examples in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salbertson committed Nov 16, 2019
1 parent 8def6ca commit bb5d7af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions spec/models/file_review_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
file_review = FileReview.new
violation_message = "violation found!"

file_review.build_violation(line, violation_message, "debugger")
file_review.build_violation(line, violation_message, "foo = bar(1, 2)")
violation = file_review.violations.first

expect(file_review.violations.size).to eq 1
expect(violation.patch_position).to eq line.patch_position
expect(violation.line_number).to eq line.number
expect(violation.messages).to eq [violation_message]
expect(violation.source).to eq "debugger"
expect(violation.source).to eq "foo = bar(1, 2)"
end
end

Expand All @@ -28,7 +28,7 @@
line = build_line(changed: false)
file_review = FileReview.new

file_review.build_violation(line, "hello", "debugger")
file_review.build_violation(line, "hello", "foo = bar(1, 2)")

expect(file_review.violations).to be_empty
end
Expand All @@ -41,8 +41,8 @@
line = build_line
file_review = FileReview.new

file_review.build_violation(line, first_violation_message, "debugger")
file_review.build_violation(line, other_violation_message, "debugger")
file_review.build_violation(line, first_violation_message, "foo = bar(1, 2)")
file_review.build_violation(line, other_violation_message, "foo = bar(1, 2)")
violation = file_review.violations.first

expect(file_review.violations.size).to eq 1
Expand Down
8 changes: 4 additions & 4 deletions spec/requests/builds_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
existing_comment_violation = {
line: 5,
message: "Line is too long.",
source: "debugger",
source: "foo = 'bbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr';",
}
new_violation1 = {
line: 3,
message: "Trailing whitespace detected.",
source: "debugger",
message: "Avoid empty else-clauses.",
source: "else {}",
}
new_violation2 = {
line: 9,
message: "Avoid empty else-clauses.",
source: "debugger",
source: "else {}",
}
violations = [new_violation1, existing_comment_violation, new_violation2]
create(:repo, :active, github_id: repo_id, name: repo_name)
Expand Down
2 changes: 1 addition & 1 deletion spec/services/complete_file_review_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def attributes
commit_sha: "abc123",
pull_request_number: 123,
patch: File.read("spec/support/fixtures/patch.diff"),
violations: [line: 14, message: "woohoo", source: "debugger"],
violations: [line: 14, message: "woohoo", source: "foo = bar(1, 2)"],
error: "Your linter config is invalid",
}
end
Expand Down

0 comments on commit bb5d7af

Please sign in to comment.