Sha256: 1eb07e274e9529bd2e377c0df485390df01dfe7b0981997105c01c705b4f8750
Contents?: true
Size: 648 Bytes
Versions: 9
Compression:
Stored size: 648 Bytes
Contents
require "spec_helper" describe Object, ".method_object" do it "creates a .call class method that instantiates and runs the #call instance method" do klass = Class.new do method_object :foo def call foo end end assert klass.call(true) refute klass.call(false) end it "doesn't require attributes" do klass = Class.new do method_object def call true end end assert klass.call end it "passes along any block" do klass = Class.new do method_object def call yield end end assert klass.call { :foo } == :foo end end
Version data entries
9 entries across 9 versions & 1 rubygems