Improved comparing values (database result maybe unsorted).

This commit is contained in:
Martin Edenhofer 2016-05-16 20:08:58 +02:00
parent 60b11db825
commit 8283194f02

View file

@ -183,7 +183,15 @@ class SessionCollectionsTest < ActiveSupport::TestCase
result[:collection][collection].each {|item| result[:collection][collection].each {|item|
match_all = true match_all = true
attributes.each {|key, value| attributes.each {|key, value|
if item[ key.to_s ] != value
# sort array, database result maybe unsorted
item_attributes = item[ key.to_s ]
if item[ key.to_s ] == Array
item_attributes.sort!
end
# compare values
if item_attributes != value
match_all = false match_all = false
end end
} }