Sha256: a2269aa3d7a23b4051b1bb1e962b83afe034798fc6c6e3b9464c639f9818c864
Contents?: true
Size: 912 Bytes
Versions: 14
Compression:
Stored size: 912 Bytes
Contents
require_relative '../../test_helper' class CallbackWithAroundTypeAndArgumentsTest < StateMachinesTest def setup @object = Object.new end def test_should_include_object_if_specified callback = StateMachines::Callback.new(:around, lambda { |object, block| @args = [object]; block.call }) callback.call(@object) assert_equal [@object], @args end def test_should_include_arguments_if_specified callback = StateMachines::Callback.new(:around, lambda { |object, arg1, arg2, arg3, block| @args = [object, arg1, arg2, arg3]; block.call }) callback.call(@object, {}, 1, 2, 3) assert_equal [@object, 1, 2, 3], @args end def test_should_include_arguments_if_splat_used callback = StateMachines::Callback.new(:around, lambda { |*args| block = args.pop; @args = args; block.call }) callback.call(@object, {}, 1, 2, 3) assert_equal [@object, 1, 2, 3], @args end end
Version data entries
14 entries across 14 versions & 2 rubygems