diff --git a/coverband.gemspec b/coverband.gemspec index ada428b2..4f963f07 100644 --- a/coverband.gemspec +++ b/coverband.gemspec @@ -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 diff --git a/lib/coverband.rb b/lib/coverband.rb index 582b5442..f7b82289 100644 --- a/lib/coverband.rb +++ b/lib/coverband.rb @@ -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" diff --git a/test/coverband/adapters/memecached_store_test.rb b/test/coverband/adapters/memecached_store_test.rb new file mode 100644 index 00000000..e76b33a0 --- /dev/null +++ b/test/coverband/adapters/memecached_store_test.rb @@ -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