Sha256: 19d40cc45286c4e78f882c26a11add9a77c40fe97171c2ca073d5e27fee8fd89
Contents?: true
Size: 754 Bytes
Versions: 15
Compression:
Stored size: 754 Bytes
Contents
require "test_helper" require "dry/container" require "trailblazer/operation/auto_inject" class DryAutoInjectTest < Minitest::Spec my_container = Dry::Container.new my_container.register(:user_repository, -> { Object }) AutoInject = Trailblazer::Operation::AutoInject(my_container) class Create < Trailblazer::Operation include AutoInject[:user_repository] end it "auto-injects user_repository" do res = Create.({}) res[:user_repository].must_equal Object end it "allows dependency injection via ::call" do Create.({}, user_repository: String)[:user_repository].must_equal String end describe "inheritance" do class Update < Create end it { Update.()[:user_repository].must_equal Object } end end
Version data entries
15 entries across 15 versions & 1 rubygems