Sha256: 030cd28131cfaad41745b4107efcc6971e5a7549b57eabe27f6661760bbe78e3
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
module Fitting module Report class Combinations def initialize(combinations) @combinations = combinations end def to_a @combinations end def size @combinations.size end def size_with_tests @combinations.count { |c| c.tests.size != 0 } end def join(tests) tests.to_a.map do |test| if there_a_suitable_combination?(test) cram_into_the_appropriate_combinations(test) test.mark_combination end end end def 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 def cram_into_the_appropriate_combinations(test) @combinations.map do |combination| combination.add_test(test) if JSON::Validator.fully_validate(combination.json_schema, test.body) == [] end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems