spec/moneta/builder_spec.rb in moneta-1.2.1 vs spec/moneta/builder_spec.rb in moneta-1.3.0

- old
+ new

@@ -23,6 +23,28 @@ use :Lock use :Lock end.build end.to raise_error /Please check/ end + + it 'dups options before passing them to each middleware' do + my_adapter = Class.new do + def initialize(options) + throw "a is missing" unless options.delete(:a) + end + end + + my_middleware = Class.new do + def initialize(backend, options) + throw "a is missing" unless options.delete(:a) + end + end + + options = { a: 1 } + Moneta::Builder.new do + use my_middleware, options + adapter my_adapter, options + end.build + + expect(options).to include(a: 1) + end end