Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 48d07a3

Browse files
committed
Remove repo dependency.
1 parent 555fb08 commit 48d07a3

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

lib/cc/formatters/snapshot_formatter.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ def to_s
4141
class Base
4242
attr_reader :alert_constants_payload, :improved_constants_payload, :details_url, :compare_url
4343

44-
def initialize(repo, payload)
45-
@repo = repo
46-
44+
def initialize(payload)
4745
new_constants = Array(payload[:new_constants])
4846
changed_constants = Array(payload[:changed_constants])
4947

@@ -75,10 +73,6 @@ def improved_constants_selector
7573
Proc.new { |constant| from_rating(constant) < C && to_rating(constant) > from_rating(constant) }
7674
end
7775

78-
def repo_identifier
79-
repo.human_name
80-
end
81-
8276
def to_rating(constant)
8377
Rating.new(constant[:to][:rating])
8478
end

lib/cc/services/slack.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ def receive_test
1616
speak(formatter.format_test)
1717

1818
# payloads for test receivers include the weekly quality report.
19-
send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Sample.new(repo, payload))
19+
send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Sample.new(payload))
2020

2121
{ ok: true, message: "Test message sent" }
2222
rescue => ex
2323
{ ok: false, message: ex.message }
2424
end
2525

2626
def receive_snapshot
27-
send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Base.new(repo, payload))
27+
send_snapshot_to_slack(CC::Formatters::SnapshotFormatter::Base.new(payload))
2828
end
2929

3030
def receive_coverage

test/formatters/snapshot_formatter_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ def described_class
66
end
77

88
def test_quality_alert_with_new_constants
9-
f = described_class.new(nil, {new_constants: [{to: {rating: "D"}}], changed_constants: []})
9+
f = described_class.new({new_constants: [{to: {rating: "D"}}], changed_constants: []})
1010
refute_nil f.alert_constants_payload
1111
end
1212

1313
def test_quality_alert_with_decreased_constants
14-
f = described_class.new(nil, {new_constants: [],
14+
f = described_class.new({new_constants: [],
1515
changed_constants: [{to: {rating: "D"}, from: {rating: "A"}}]
1616
})
1717
refute_nil f.alert_constants_payload
1818
end
1919

2020
def test_quality_improvements_with_better_ratings
21-
f = described_class.new(nil, {new_constants: [],
21+
f = described_class.new({new_constants: [],
2222
changed_constants: [{to: {rating: "A"}, from: {rating: "D"}}]
2323
})
2424
refute_nil f.improved_constants_payload
2525
end
2626

2727
def test_nothing_set_without_changes
28-
f = described_class.new(nil, {new_constants: [], changed_constants: []})
28+
f = described_class.new({new_constants: [], changed_constants: []})
2929
assert_nil f.alert_constants_payload
3030
assert_nil f.improved_constants_payload
3131
end
3232

3333
def test_snapshot_formatter_test_with_relaxed_constraints
34-
f = CC::Formatters::SnapshotFormatter::Sample.new(nil, {
34+
f = CC::Formatters::SnapshotFormatter::Sample.new({
3535
new_constants: [{name: "foo", to: {rating: "A"}}, {name: "bar", to: {rating: "A"}}],
3636
changed_constants: [
3737
{from: {rating: "B"}, to: {rating: "C"}},

0 commit comments

Comments
 (0)