Class: Fitting::Report::Tests

Inherits:
Object
  • Object
show all
Defined in:
lib/fitting/report/tests.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tests) ⇒ Tests

Returns a new instance of Tests.



6
7
8
# File 'lib/fitting/report/tests.rb', line 6

def initialize(tests)
  @tests = tests
end

Class Method Details

.new_from_config(tests_path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/fitting/report/tests.rb', line 10

def self.new_from_config(tests_path)
  tests = []
  Dir[tests_path].each do |file|
    JSON.load(File.read(file)).map do |test|
      tests.push(Fitting::Report::Test.new(test))
    end
  end
  tests.sort { |a, b| b.path <=> a.path }
  new(tests)
end

Instance Method Details

#push(test) ⇒ Object



49
50
51
# File 'lib/fitting/report/tests.rb', line 49

def push(test)
  @tests.push(test)
end

#sizeObject



53
54
55
# File 'lib/fitting/report/tests.rb', line 53

def size
  @tests.size
end

#to_aObject



57
58
59
# File 'lib/fitting/report/tests.rb', line 57

def to_a
  @tests
end

#to_hObject



61
62
63
64
65
66
# File 'lib/fitting/report/tests.rb', line 61

def to_h
  return @hash if @hash
  @hash = @tests.inject({}) do |res, test|
    res.merge!(test.id => test.to_h)
  end
end

#without_actionsObject



28
29
30
31
32
33
# File 'lib/fitting/report/tests.rb', line 28

def without_actions
  @tests.inject([]) do |result, test|
    result.push("#{test.method} #{test.path}") unless test.is_there_an_actions?
    result
  end
end

#without_combinationsObject



42
43
44
45
46
47
# File 'lib/fitting/report/tests.rb', line 42

def without_combinations
  @tests.inject([]) do |result, test|
    result.push(test.path) unless test.is_there_an_combinations?
    result
  end
end

#without_prefixesObject



21
22
23
24
25
26
# File 'lib/fitting/report/tests.rb', line 21

def without_prefixes
  @tests.inject([]) do |result, test|
    result.push(test.path) unless test.is_there_a_prefix?
    result
  end
end

#without_responsesObject



35
36
37
38
39
40
# File 'lib/fitting/report/tests.rb', line 35

def without_responses
  @tests.inject([]) do |result, test|
    result.push(test.id) unless test.is_there_an_responses?
    result
  end
end