Improved comparing values (database result maybe unsorted).
This commit is contained in:
parent
60b11db825
commit
8283194f02
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue