Class: Fitting::Report::Console

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

Instance Method Summary collapse

Constructor Details

#initialize(tests_without_prefixes, prefixes_details) ⇒ Console

Returns a new instance of Console.



4
5
6
7
8
9
10
# File 'lib/fitting/report/console.rb', line 4

def initialize(tests_without_prefixes, prefixes_details)
  @tests_without_prefixes = tests_without_prefixes
  @prefixes_details = prefixes_details
  @good = true
  @tests_without_actions = []
  @tests_without_responses = []
end

Instance Method Details

#good?Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
# File 'lib/fitting/report/console.rb', line 33

def good?
  return false if @tests_without_prefixes.size != 0
  return false if @tests_without_actions.size != 0
  return false if @tests_without_responses.size != 0
  @good
end

#outputObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fitting/report/console.rb', line 12

def output
  doc_res = @prefixes_details.inject('') do |res, prefix_details|
    res += "#{prefix_details[:name]}\n"
    @tests_without_actions += prefix_details[:actions][:tests_without_actions]
    res += prefix_details[:actions][:actions_details].inject('') do |res_actions, action|
      res_actions += "#{action[:method]}\t#{action[:path]}"
      tab = "\t" * ((3 - action[:path].size / 8) + 3)
      @tests_without_responses += action[:responses][:tests_without_responses]
      res_actions += tab + action[:responses][:responses_details].inject('') do |res_responses, response|
        @good = false if response[:combinations][:cover_percent] != '100%'
        res_responses += " #{response[:combinations][:cover_percent]} #{response[:method]}"
      end
      res_actions += "\n"
    end
  end
  doc_res += "\n"
  doc_res += "tests_without_prefixes: #{@tests_without_prefixes.size}\n"
  doc_res += "tests_without_actions: #{@tests_without_actions.size}\n"
  doc_res += "tests_without_responses: #{@tests_without_responses.size}\n"
end