Class: Fix::Test Private
- Inherits:
-
Object
- Object
- Fix::Test
- 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
-
#configuration ⇒ Hash
readonly
private
The settings.
-
#results ⇒ Array
readonly
private
The results.
-
#total_time ⇒ Float
readonly
private
The total time.
Instance Method Summary collapse
-
#fail? ⇒ Boolean
private
Return false if the test fail.
-
#initialize(front_object, verbose: true, color: true, **options, &specs) ⇒ Test
constructor
private
Initialize the test class.
-
#pass? ⇒ Boolean
private
The state of the test.
-
#report ⇒ Report
private
The report of the test.
-
#statistics ⇒ Hash
private
Some statistics.
Constructor Details
#initialize(front_object, verbose: true, color: true, **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.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fix/test.rb', line 14 def initialize(front_object, verbose: true, color: true, **, &specs) @configuration = .merge( verbose: verbose, color: color ) 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
#configuration ⇒ Hash (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.
32 33 34 |
# File 'lib/fix/test.rb', line 32 def configuration @configuration end |
#results ⇒ Array (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.
37 38 39 |
# File 'lib/fix/test.rb', line 37 def results @results end |
#total_time ⇒ Float (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.
42 43 44 |
# File 'lib/fix/test.rb', line 42 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.
71 72 73 |
# File 'lib/fix/test.rb', line 71 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.
66 67 68 |
# File 'lib/fix/test.rb', line 66 def pass? results.all?(&:result?) end |
#report ⇒ Report
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.
59 60 61 |
# File 'lib/fix/test.rb', line 59 def report Report.new(self) end |
#statistics ⇒ Hash
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.
47 48 49 50 51 52 53 54 |
# File 'lib/fix/test.rb', line 47 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 |