Skip to content

Commit

Permalink
fix for #539 ensure we use namespace when available for abstract tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
danmayer committed Jun 2, 2024
1 parent 30e6d49 commit 437a8db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion lib/coverband/collectors/abstract_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ def tracker_time_key
end

def class_key
@class_key ||= self.class.name.split("::").last
@class_key ||= if Coverband.configuration.redis_namespace
"#{Coverband.configuration.redis_namespace}_#{self.class.name.split("::").last}"
else
self.class.name.split("::").last
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/coverband/collectors/route_tracker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def setup
method: "GET"
}
store.raw_store.expects(:del).with(tracker_key)
store.raw_store.expects(:del).with("RouteTracker_tracker_time")
store.raw_store.expects(:del).with("#{tracker_key}_time")
tracker = Coverband::Collectors::RouteTracker.new(store: store, roots: "dir")
tracker.track_key(payload)
tracker.reset_recordings
Expand Down
4 changes: 2 additions & 2 deletions test/coverband/collectors/view_tracker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class ViewTrackerTest < Minitest::Test
def tracker_key
"ViewTracker_tracker"
"coverband_test_ViewTracker_tracker"
end

def setup
Expand Down Expand Up @@ -98,7 +98,7 @@ def setup
Coverband::Collectors::ViewTracker.expects(:supported_version?).returns(true)
store = fake_store
store.raw_store.expects(:del).with(tracker_key)
store.raw_store.expects(:del).with("ViewTracker_tracker_time")
store.raw_store.expects(:del).with("#{tracker_key}_time")
tracker = Coverband::Collectors::ViewTracker.new(store: store, roots: "dir")
tracker.track_key(identifier: "file")
tracker.reset_recordings
Expand Down

0 comments on commit 437a8db

Please sign in to comment.