Sha256: 438121a68f95ce39b4d96bd3ad4803dd0593921b2c0632ce564bafaa4e0743ec
Contents?: true
Size: 753 Bytes
Versions: 3
Compression:
Stored size: 753 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 @album = album @guitarist = guitarist end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
invokr-0.9.1 | test/dependency_injection_test.rb |
invokr-0.9.0 | test/dependency_injection_test.rb |
invokr-0.1.0 | test/dependency_injection_example_test.rb |