From 268db53bf87e1251c5e64617c94f23dd6b81f1c5 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 23 Mar 2019 20:23:31 -0600 Subject: [PATCH] Use more sensible label for non-labeled procs --- spec/expectations/block_expectation_partial_spec.cr | 4 ++-- src/spectator/expectations/block_expectation_partial.cr | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/expectations/block_expectation_partial_spec.cr b/spec/expectations/block_expectation_partial_spec.cr index a4a1814..ea54f3a 100644 --- a/spec/expectations/block_expectation_partial_spec.cr +++ b/spec/expectations/block_expectation_partial_spec.cr @@ -30,10 +30,10 @@ describe Spectator::Expectations::BlockExpectationPartial do end context "when omitted" do - it "contains a stringified version of #actual" do + it "contains \"proc\"" do actual = ->{ 777 } partial = Spectator::Expectations::BlockExpectationPartial.new(actual, __FILE__, __LINE__) - partial.label.should eq(actual.to_s) + partial.label.should match(/proc/i) end end end diff --git a/src/spectator/expectations/block_expectation_partial.cr b/src/spectator/expectations/block_expectation_partial.cr index 8c18825..f9a8f6f 100644 --- a/src/spectator/expectations/block_expectation_partial.cr +++ b/src/spectator/expectations/block_expectation_partial.cr @@ -19,7 +19,7 @@ module Spectator::Expectations # The label is generated by calling to_s on the block. # The block is stored for later use. protected def initialize(@block : Proc(ReturnType), source_file, source_line) - super(@block.to_s, source_file, source_line) + super("", source_file, source_line) end end end