Applied rubocop cop 'Style/Next'.
This commit is contained in:
parent
70e126a95c
commit
efbeef41e1
1 changed files with 13 additions and 14 deletions
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable Next, CyclomaticComplexity
|
||||
require 'test_helper'
|
||||
|
||||
class SessionCollectionsTest < ActiveSupport::TestCase
|
||||
|
@ -139,22 +138,22 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
|||
def check_if_collection_exists(results, collection, attributes = nil)
|
||||
results.each {|result|
|
||||
next if !result
|
||||
if result[:collection] && result[:collection][collection]
|
||||
next if !result[:collection]
|
||||
next if !result[:collection][collection]
|
||||
|
||||
# check just if collection exists
|
||||
return true if !attributes
|
||||
# check just if collection exists
|
||||
return true if !attributes
|
||||
|
||||
# check if objetc with attributes in collection exists
|
||||
result[:collection][collection].each {|item|
|
||||
match_all = true
|
||||
attributes.each {|key, value|
|
||||
if item[ key.to_s ] != value
|
||||
match_all = false
|
||||
end
|
||||
}
|
||||
return true if match_all
|
||||
# check if objetc with attributes in collection exists
|
||||
result[:collection][collection].each {|item|
|
||||
match_all = true
|
||||
attributes.each {|key, value|
|
||||
if item[ key.to_s ] != value
|
||||
match_all = false
|
||||
end
|
||||
}
|
||||
end
|
||||
return true if match_all
|
||||
}
|
||||
}
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue