Class: AirborneReport::Report

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_json, notification) ⇒ Report

Returns a new instance of Report.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/airborne_report/report.rb', line 3

def initialize(before_json, notification)
  after_json = {}
  statuses = {
    'all' => 0,
    'passed' => 0,
    'failed' => 0,
    'pending' => 0
  }

  notification.examples.map do |example|
    location = example.[:location]
    after_json[location] = craft_example(before_json, location, example)
    statuses = increment_statuses(statuses, example)
  end

  @json = {
    'statuses' => statuses,
    'tests' => after_json
  }
end

Class Method Details

.blankObject



24
25
26
27
28
# File 'lib/airborne_report/report.rb', line 24

def self.blank
  {
    'tests' => {}
  }
end

Instance Method Details

#to_hashObject



30
31
32
# File 'lib/airborne_report/report.rb', line 30

def to_hash
  @json
end