Class: Specjour::Rspec::FinalReport
- Inherits:
-
Object
- Object
- Specjour::Rspec::FinalReport
- Defined in:
- lib/specjour/rspec/final_report.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#example_count ⇒ Object
readonly
Returns the value of attribute example_count.
-
#failing_examples ⇒ Object
readonly
Returns the value of attribute failing_examples.
-
#failure_count ⇒ Object
readonly
Returns the value of attribute failure_count.
-
#pending_count ⇒ Object
readonly
Returns the value of attribute pending_count.
-
#pending_examples ⇒ Object
readonly
Returns the value of attribute pending_examples.
Instance Method Summary collapse
- #add(stats) ⇒ Object
- #dump_failures ⇒ Object
- #exit_status ⇒ Object
- #formatter ⇒ Object
- #formatter_options ⇒ Object
- #increment(key, value) ⇒ Object
-
#initialize ⇒ FinalReport
constructor
A new instance of FinalReport.
- #summarize ⇒ Object
Constructor Details
#initialize ⇒ FinalReport
Returns a new instance of FinalReport.
6 7 8 9 10 11 12 13 |
# File 'lib/specjour/rspec/final_report.rb', line 6 def initialize @duration = 0.0 @example_count = 0 @failure_count = 0 @pending_count = 0 @pending_examples = [] @failing_examples = [] end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def duration @duration end |
#example_count ⇒ Object (readonly)
Returns the value of attribute example_count.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def example_count @example_count end |
#failing_examples ⇒ Object (readonly)
Returns the value of attribute failing_examples.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def failing_examples @failing_examples end |
#failure_count ⇒ Object (readonly)
Returns the value of attribute failure_count.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def failure_count @failure_count end |
#pending_count ⇒ Object (readonly)
Returns the value of attribute pending_count.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def pending_count @pending_count end |
#pending_examples ⇒ Object (readonly)
Returns the value of attribute pending_examples.
4 5 6 |
# File 'lib/specjour/rspec/final_report.rb', line 4 def pending_examples @pending_examples end |
Instance Method Details
#add(stats) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/specjour/rspec/final_report.rb', line 15 def add(stats) stats.each do |key, value| if key == :duration @duration = value.to_f if duration < value.to_f else increment(key, value) end end end |
#dump_failures ⇒ Object
58 59 60 61 62 |
# File 'lib/specjour/rspec/final_report.rb', line 58 def dump_failures failing_examples.each_with_index do |failure, index| formatter.dump_failure index + 1, failure end end |
#exit_status ⇒ Object
25 26 27 |
# File 'lib/specjour/rspec/final_report.rb', line 25 def exit_status failing_examples.empty? end |
#formatter ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/specjour/rspec/final_report.rb', line 42 def formatter @formatter ||= begin f = Spec::Runner::Formatter::BaseTextFormatter.new(, $stdout) f.instance_variable_set(:@pending_examples, pending_examples) f end end |
#formatter_options ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/specjour/rspec/final_report.rb', line 34 def @formatter_options ||= OpenStruct.new( :colour => true, :autospec => false, :dry_run => false ) end |
#increment(key, value) ⇒ Object
29 30 31 32 |
# File 'lib/specjour/rspec/final_report.rb', line 29 def increment(key, value) current = instance_variable_get("@#{key}") instance_variable_set("@#{key}", current + value) end |
#summarize ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/specjour/rspec/final_report.rb', line 50 def summarize if example_count > 0 formatter.dump_pending dump_failures formatter.dump_summary(duration, example_count, failure_count, pending_count) end end |