class MotionSpec::Matcher::MatchArray
Public Class Methods
new(expected_array)
click to toggle source
# File lib/motion-spec/matcher/match_array.rb, line 4 def initialize(expected_array) @expected_array = expected_array end
Public Instance Methods
fail!(subject_array, negated)
click to toggle source
# File lib/motion-spec/matcher/match_array.rb, line 18 def fail!(subject_array, negated) fail FailedExpectation.new( FailMessageRenderer.message_for_match_array( negated, subject_array, @expected_array ) ) end
matches?(subject_array)
click to toggle source
# File lib/motion-spec/matcher/match_array.rb, line 8 def matches?(subject_array) return false unless subject_array.size == @expected_array.size array_copy = subject_array.dup @expected_array.all? do |item| has = array_copy.include?(item) array_copy.delete(item) if has has end end