From d5bef6f1da34c14311905021095bbc67afb4399f Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 28 Feb 2019 16:08:22 -0700 Subject: [PATCH] Fix flipped expected and actual labels NilMatcher output was correct, but variables were named incorrectly. --- src/spectator/matchers/equality_matcher.cr | 4 ++-- src/spectator/matchers/nil_matcher.cr | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spectator/matchers/equality_matcher.cr b/src/spectator/matchers/equality_matcher.cr index eadde55..49914a3 100644 --- a/src/spectator/matchers/equality_matcher.cr +++ b/src/spectator/matchers/equality_matcher.cr @@ -34,13 +34,13 @@ module Spectator::Matchers # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. def message - "#{@values.expected_label} is #{@values.actual_label} (using ==)" + "#{@values.actual_label} is #{@values.expected_label} (using ==)" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. def negated_message - "#{@values.expected_label} is not #{@values.actual_label} (using ==)" + "#{@values.actual_label} is not #{@values.expected_label} (using ==)" end end end diff --git a/src/spectator/matchers/nil_matcher.cr b/src/spectator/matchers/nil_matcher.cr index ccc6627..fcf0c9f 100644 --- a/src/spectator/matchers/nil_matcher.cr +++ b/src/spectator/matchers/nil_matcher.cr @@ -20,7 +20,7 @@ module Spectator::Matchers # Match data specific to this matcher. private struct MatchData(T) < MatchData # Creates the match data. - def initialize(matched, @actual : T, @expected_label : String) + def initialize(matched, @actual : T, @actual_label : String) super(matched) end @@ -35,13 +35,13 @@ module Spectator::Matchers # Describes the condition that satisfies the matcher. # This is informational and displayed to the end-user. def message - "#{@expected_label} is nil" + "#{@actual_label} is nil" end # Describes the condition that won't satsify the matcher. # This is informational and displayed to the end-user. def negated_message - "#{@expected_label} is not nil" + "#{@actual_label} is not nil" end end end