Class: Fix::Test Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fix/test.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wraps the target of the specs document.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(front_object, options = {}, &specs) ⇒ Test

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize the test class.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fix/test.rb', line 12

def initialize(front_object, options = {}, &specs)
  @configuration = { verbose: true, color: true }
  @configuration.update(options)

  start_time = Time.now

  g = On.new(front_object, [], [], {}, @configuration)
  g.instance_eval(&specs)

  @results    = g.results
  @total_time = Time.now - start_time
end

Instance Attribute Details

#configurationHash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The settings.



28
29
30
# File 'lib/fix/test.rb', line 28

def configuration
  @configuration
end

#resultsArray (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The results.



33
34
35
# File 'lib/fix/test.rb', line 33

def results
  @results
end

#total_timeFloat (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The total time.



38
39
40
# File 'lib/fix/test.rb', line 38

def total_time
  @total_time
end

Instance Method Details

#fail?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return false if the test fail.



67
68
69
# File 'lib/fix/test.rb', line 67

def fail?
  !pass?
end

#pass?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The state of the test.



62
63
64
# File 'lib/fix/test.rb', line 62

def pass?
  results.all?(&:result?)
end

#reportReport

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The report of the test.



55
56
57
# File 'lib/fix/test.rb', line 55

def report
  Report.new(self)
end

#statisticsHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Some statistics.



43
44
45
46
47
48
49
50
# File 'lib/fix/test.rb', line 43

def statistics
  {
    pass_percent:   pass_percent,
    total_infos:    results.count { |r| r.to_sym.equal?(:info) },
    total_failures: results.count { |r| r.to_sym.equal?(:failure) },
    total_errors:   results.count { |r| r.to_sym.equal?(:error) }
  }
end