class Fitting::Report::Combinations
Public Class Methods
new(combinations)
click to toggle source
# File lib/fitting/report/combinations.rb, line 4 def initialize(combinations) @combinations = combinations end
Public Instance Methods
cram_into_the_appropriate_combinations(test)
click to toggle source
# File lib/fitting/report/combinations.rb, line 38 def cram_into_the_appropriate_combinations(test) @combinations.map do |combination| if JSON::Validator.fully_validate(combination.json_schema, test.body) == [] combination.add_test(test) end end end
is_there_a_suitable_combination?(test)
click to toggle source
# File lib/fitting/report/combinations.rb, line 29 def is_there_a_suitable_combination?(test) return false if @combinations.nil? @combinations.map do |combination| return true if JSON::Validator.fully_validate(combination.json_schema, test.body) == [] end false end
join(tests)
click to toggle source
# File lib/fitting/report/combinations.rb, line 20 def join(tests) tests.to_a.map do |test| if is_there_a_suitable_combination?(test) cram_into_the_appropriate_combinations(test) test.mark_combination end end end
size()
click to toggle source
# File lib/fitting/report/combinations.rb, line 12 def size @combinations.size end
size_with_tests()
click to toggle source
# File lib/fitting/report/combinations.rb, line 16 def size_with_tests @combinations.count { |c| c.tests.size != 0 } end
to_a()
click to toggle source
# File lib/fitting/report/combinations.rb, line 8 def to_a @combinations end