summaryrefslogtreecommitdiff
path: root/app/serializers/test_suite_comparer_entity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/test_suite_comparer_entity.rb')
-rw-r--r--app/serializers/test_suite_comparer_entity.rb27
1 files changed, 6 insertions, 21 deletions
diff --git a/app/serializers/test_suite_comparer_entity.rb b/app/serializers/test_suite_comparer_entity.rb
index a9f19564b60..aab805f9598 100644
--- a/app/serializers/test_suite_comparer_entity.rb
+++ b/app/serializers/test_suite_comparer_entity.rb
@@ -1,9 +1,6 @@
# frozen_string_literal: true
class TestSuiteComparerEntity < Grape::Entity
- DEFAULT_MAX_TESTS = 100
- DEFAULT_MIN_TESTS = 10
-
expose :name
expose :total_status, as: :status
@@ -14,39 +11,27 @@ class TestSuiteComparerEntity < Grape::Entity
expose :error_count, as: :errored
end
- # rubocop: disable CodeReuse/ActiveRecord
expose :new_failures, using: TestCaseEntity do |suite|
- suite.new_failures.take(max_tests)
+ suite.limited_tests.new_failures
end
expose :existing_failures, using: TestCaseEntity do |suite|
- suite.existing_failures.take(
- max_tests(suite.new_failures))
+ suite.limited_tests.existing_failures
end
expose :resolved_failures, using: TestCaseEntity do |suite|
- suite.resolved_failures.take(
- max_tests(suite.new_failures, suite.existing_failures))
+ suite.limited_tests.resolved_failures
end
expose :new_errors, using: TestCaseEntity do |suite|
- suite.new_errors.take(max_tests)
+ suite.limited_tests.new_errors
end
expose :existing_errors, using: TestCaseEntity do |suite|
- suite.existing_errors.take(
- max_tests(suite.new_errors))
+ suite.limited_tests.existing_errors
end
expose :resolved_errors, using: TestCaseEntity do |suite|
- suite.resolved_errors.take(
- max_tests(suite.new_errors, suite.existing_errors))
- end
-
- private
-
- def max_tests(*used)
- [DEFAULT_MAX_TESTS - used.map(&:count).sum, DEFAULT_MIN_TESTS].max
+ suite.limited_tests.resolved_errors
end
- # rubocop: enable CodeReuse/ActiveRecord
end