50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/feature_map/private/test_pyramid_file.rb', line 50
def self.generate_content(unit_examples, integration_examples, regression_examples, regression_file_assignments)
Private.feature_file_assignments.reduce({}) do |content, (feature_name, files)|
regression_files = regression_file_assignments[feature_name] || []
regression_count, regression_pending = regression_files.reduce([0, 0]) do |accumulated_counts, file|
accumulated_count, accumulated_pending = accumulated_counts
count, pending = split(regression_examples[file])
[accumulated_count + count, accumulated_pending + pending]
end
pyramid = files.reduce({}) do |acc, file|
normalized_path = filepath(file)
unit_count, unit_pending = split(unit_examples["#{normalized_path}_spec"])
integration_count, integration_pending = split(integration_examples[normalized_path])
{
'unit_count' => (acc['unit_count'] || 0) + unit_count,
'unit_pending' => (acc['unit_pending'] || 0) + unit_pending,
'integration_count' => (acc['integration_count'] || 0) + integration_count,
'integration_pending' => (acc['integration_pending'] || 0) + integration_pending
}
end
{
feature_name => pyramid.merge(
'regression_count' => regression_count,
'regression_pending' => regression_pending
),
**content
}
end
end
|