我是rails rpecs的新手。我有一个lib函数,并尝试从该函数返回多个@unmatched和@mismatched数组。所以我想使用rspec collection打印这两个数组大小。请帮助
LIB / property_matcher.rb
@properties.each do |property|
find_property_by_source_property_id(property)
find_property_chain_code(property)
find_property_pegasus_code(property)
if !@property_by_source_property_id.present?
unmatch_property = !@property_by_source_property_id.present?
save_unmatch_mismatch_property(property)
@unmatch_property << unmatch_property
elsif @property_by_source_property_id.present? && !(property_chain_code == property['property_chain_code'] && property_pegasus_code == property['pegasus_code'])
save_unmatch_mismatch_property(property)
@mismatch_property << (@property_by_source_property_id.present? && !(property_chain_code == property['property_chain_code'] && property_pegasus_code == property['pegasus_code']))
else
end
return [@unmatch_property, @mismatch_property]
end
规格/ property_matcher_spec.rb
it "Find using source_property_id and match property_chain_id and pegasus_code if record found" do
file = 'doc/properties.csv'
expect do
PropertyMatcher.new().check_and_match_property(file)
end
end
我应该怎么做打印@unatch_property和@mismatch_property ??