Sha256: 97771de6b8f3ee1169bdac441a74164b7214be5b19381197f4b003b39873a503
Contents?: true
Size: 762 Bytes
Versions: 2
Compression:
Stored size: 762 Bytes
Contents
require 'ostruct' class DependencyInjectionExampleTest < Minitest::Test def test_dependency_injection obj = Invokr.inject( TestObject, :using => { :album => 'farmhouse', :guitarist => 'trey', :drummer => 'fishman', }, ) assert_equal 'farmhouse', obj.album assert_equal 'trey', obj.guitarist end def test_injecting_a_proc my_proc = -> foo do OpenStruct.new foo: foo end obj = Invokr.inject( my_proc, :using => { :foo => 'bar', :ping => 'pong', } ) assert_equal 'bar', obj.foo end class TestObject attr :album, :guitarist def initialize album, guitarist: 'jimmy' @album = album @guitarist = guitarist end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
invokr-0.9.3 | test/dependency_injection_test.rb |
invokr-0.9.2 | test/dependency_injection_test.rb |