diff --git a/src/spectator/fail_result.cr b/src/spectator/fail_result.cr index f331d07..894defa 100644 --- a/src/spectator/fail_result.cr +++ b/src/spectator/fail_result.cr @@ -41,7 +41,7 @@ module Spectator # Attempts to retrieve the location where the example failed. # This only works if the location of the failed expectation was reported. # If available, returns a `Location`, otherwise `nil`. - def source : Location? + def location : Location? return unless error = @error.as?(ExampleFailed) error.location? diff --git a/src/spectator/formatting/components/failure_command_list.cr b/src/spectator/formatting/components/failure_command_list.cr index 177cf1a..ceb3242 100644 --- a/src/spectator/formatting/components/failure_command_list.cr +++ b/src/spectator/formatting/components/failure_command_list.cr @@ -15,8 +15,8 @@ module Spectator::Formatting::Components io.puts @failures.each do |failure| # Use failed location if it's available. - if (result = failure.result).responds_to?(:source) - location = result.source + if (result = failure.result).responds_to?(:location) + location = result.location end io.puts ExampleCommand.new(failure, location).colorize(:red) diff --git a/src/spectator/formatting/components/result_block.cr b/src/spectator/formatting/components/result_block.cr index 189bfbe..36eb1a6 100644 --- a/src/spectator/formatting/components/result_block.cr +++ b/src/spectator/formatting/components/result_block.cr @@ -48,7 +48,7 @@ module Spectator::Formatting::Components subtitle_line(io) io.puts content(io) - source_line(io) + location_line(io) end end @@ -68,16 +68,16 @@ module Spectator::Formatting::Components end end - # Produces the (example) source line. - private def source_line(io) - source = if (result = @example.result).responds_to?(:source) - result.source - else - @example.location? - end - return unless source + # Produces the (example) location line. + private def location_line(io) + location = if (result = @example.result).responds_to?(:location) + result.location + else + @example.location? + end + return unless location - line(io) { io << Comment.colorize(source) } + line(io) { io << Comment.colorize(location) } end # Computes the number of spaces the index takes