Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Memcached adapter; add test #554

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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