Use more sensible label for non-labeled procs

This commit is contained in:
Michael Miller 2019-03-23 20:23:31 -06:00
parent ac85fac968
commit 268db53bf8
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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("<Proc>", source_file, source_line)
end
end
end