Skip to content

Commit

Permalink
numericality: Do not run all submatchers
Browse files Browse the repository at this point in the history
This commit changes the numericality matcher so that when running
submatchers, the matcher will stop on the first one that fails instead
of running them all. Since all of the submatchers modify the same
record, running all of them is actually bad since it could possibly make
the failure message confusing (since the record will be in a mixed
state).
  • Loading branch information
mcmire committed Dec 31, 2015
1 parent 46f6736 commit 8e24a6e
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,7 @@ def update_diff_to_compare(matcher)
end

def first_failing_submatcher
failing_submatchers.first
end

def failing_submatchers
@_failing_submatchers ||= @submatchers.select do |submatcher|
@_failing_submatchers ||= @submatchers.detect do |submatcher|
!submatcher.matches?(@subject)
end
end
Expand Down

0 comments on commit 8e24a6e

Please sign in to comment.