Skip to content

Commit

Permalink
Merge pull request #554 from colemanja91/require-memcached-adapter
Browse files Browse the repository at this point in the history
Require Memcached adapter; add test
  • Loading branch information
danmayer authored Oct 11, 2024
2 parents ab80293 + 75750d7 commit 4e4bd3d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions coverband.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Gem::Specification.new do |spec|
# minitest-profile is not compatible with Rails 7.1.0 setup... dropping it for now
# spec.add_development_dependency "minitest-profile"
spec.add_development_dependency "webmock"
spec.add_development_dependency "dalli" # Default memcached adapter

# TODO: Remove when other production adapters exist
# because the default configuration of redis store, we really do require
Expand Down
1 change: 1 addition & 0 deletions lib/coverband.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
require "coverband/adapters/file_store"
require "coverband/adapters/stdout_store"
require "coverband/adapters/null_store"
require "coverband/adapters/memcached_store"
require "coverband/utils/file_hasher"
require "coverband/collectors/coverage"
require "coverband/collectors/abstract_tracker"
Expand Down
26 changes: 26 additions & 0 deletions test/coverband/adapters/memecached_store_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require File.expand_path("../../test_helper", File.dirname(__FILE__))

if ENV["COVERBAND_MEMCACHED"]
require "active_support"
require "dalli"

class MemcachedTest < Minitest::Test
def setup
super
@store = Coverband::Adapters::MemcachedStore.new(ActiveSupport::Cache::MemCacheStore.new)
end

def test_coverage
@store.clear!
mock_file_hash
expected = basic_coverage
@store.save_report(expected)
assert_equal expected.keys, @store.coverage.keys
@store.coverage.each_pair do |key, data|
assert_equal expected[key], data["data"]
end
end
end
end

0 comments on commit 4e4bd3d

Please sign in to comment.