lib/deimos/test_helpers.rb in deimos-ruby-1.3.0.pre.beta1 vs lib/deimos/test_helpers.rb in deimos-ruby-1.3.0.pre.beta2
- old
+ new
@@ -136,11 +136,11 @@
_stub_base_consumer(klass)
klass.class_eval do
alias_method(:old_consume, :consume) unless self.instance_methods.include?(:old_consume)
end
allow_any_instance_of(klass).to receive(:consume) do |instance, payload, metadata|
- metadata[:key] = klass.new.decode_key(metadata[:key])
+ metadata[:key] = klass.new.decode_key(metadata[:key]) if klass.config[:key_configured]
instance.old_consume(payload, metadata)
end
end
# Stub a given batch consumer class.
@@ -443,9 +443,11 @@
private
def _key_from_consumer(consumer)
if consumer.config[:key_field] || consumer.config[:key_schema]
{ 'test' => 1 }
+ elsif consumer.config[:no_keys]
+ nil
else
1
end
end