Sha256: 4d33bbc732ecf493be2d055f4d52b37632421c4873cce4d718f89218bc1659f6
Contents?: true
Size: 734 Bytes
Versions: 14
Compression:
Stored size: 734 Bytes
Contents
require_relative '../../test_helper' class CallbackWithAroundTypeAndBoundMethodTest < StateMachinesTest def setup @object = Object.new end def test_should_call_method_within_the_context_of_the_object context = nil callback = StateMachines::Callback.new(:around, do: lambda { |block| context = self; block.call }, bind_to_object: true) callback.call(@object, {}, 1, 2, 3) assert_equal @object, context end def test_should_include_arguments_if_specified context = nil callback = StateMachines::Callback.new(:around, do: lambda { |*args| block = args.pop; context = args; block.call }, bind_to_object: true) callback.call(@object, {}, 1, 2, 3) assert_equal [1, 2, 3], context end end
Version data entries
14 entries across 14 versions & 2 rubygems