Use fresh variables

This commit is contained in:
Michael Miller 2019-09-01 00:54:04 -06:00
parent 19913a28d1
commit 1c5b46b981

View file

@ -23,9 +23,9 @@ module Spectator::DSL
# Where the actual value is returned by the system-under-test, # Where the actual value is returned by the system-under-test,
# and the expected value is what the actual value should be to satisfy the condition. # and the expected value is what the actual value should be to satisfy the condition.
macro expect(actual, _source_file = __FILE__, _source_line = __LINE__) macro expect(actual, _source_file = __FILE__, _source_line = __LINE__)
test_value = ::Spectator::TestValue.new({{actual}}, {{actual.stringify}}) %test_value = ::Spectator::TestValue.new({{actual}}, {{actual.stringify}})
source = ::Spectator::Source.new({{_source_file}}, {{_source_line}}) %source = ::Spectator::Source.new({{_source_file}}, {{_source_line}})
::Spectator::Expectations::ExpectationPartial.new(test_value, source) ::Spectator::Expectations::ExpectationPartial.new(%test_value, %source)
end end
# Starts an expectation on a block of code. # Starts an expectation on a block of code.