Class: Fivemat::RSpec
- Inherits:
-
RSpec::Core::Formatters::ProgressFormatter
- Object
- RSpec::Core::Formatters::ProgressFormatter
- Fivemat::RSpec
- Includes:
- ElapsedTime
- Defined in:
- lib/fivemat/rspec.rb
Instance Method Summary collapse
- #dump_pending_fixed(example, index) ⇒ Object
- #dump_summary ⇒ Object
- #example_group_finished(group) ⇒ Object
- #example_group_started(group) ⇒ Object
-
#initialize ⇒ RSpec
constructor
A new instance of RSpec.
- #pending_fixed?(example) ⇒ Boolean
- #start_dump ⇒ Object
Methods included from ElapsedTime
Constructor Details
#initialize ⇒ RSpec
Returns a new instance of RSpec.
7 8 9 10 11 12 |
# File 'lib/fivemat/rspec.rb', line 7 def initialize(*) super @group_level = 0 @index_offset = 0 @cumulative_failed_examples = [] end |
Instance Method Details
#dump_pending_fixed(example, index) ⇒ Object
54 55 56 57 |
# File 'lib/fivemat/rspec.rb', line 54 def dump_pending_fixed(example, index) output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED" output.puts blue("#{long_padding}Expected pending '#{example.[:execution_result][:pending_message]}' to fail. No Error was raised.") end |
#dump_summary ⇒ Object
59 60 61 62 |
# File 'lib/fivemat/rspec.rb', line 59 def dump_summary(*) @failed_examples = @cumulative_failed_examples super end |
#example_group_finished(group) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fivemat/rspec.rb', line 23 def example_group_finished(group) @group_level -= 1 if @group_level.zero? print_elapsed_time output, @start_time output.puts failed_examples.each_with_index do |example, index| if pending_fixed?(example) dump_pending_fixed(example, @index_offset + index) else dump_failure(example, @index_offset + index) end dump_backtrace(example) end @index_offset += failed_examples.size @cumulative_failed_examples += failed_examples failed_examples.clear end end |
#example_group_started(group) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/fivemat/rspec.rb', line 14 def example_group_started(group) if @group_level.zero? output.print "#{group.description} " @failure_output = [] @start_time = Time.now end @group_level += 1 end |
#pending_fixed?(example) ⇒ Boolean
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fivemat/rspec.rb', line 43 def pending_fixed?(example) if example.execution_result[:exception].respond_to?(:pending_fixed?) example.execution_result[:exception].pending_fixed? elsif defined?(::RSpec::Core::Pending::PendingExampleFixedError) # RSpec 2.99.2 compatibility ::RSpec::Core::Pending::PendingExampleFixedError == example.execution_result[:exception] else ::RSpec::Core::PendingExampleFixedError === example.execution_result[:exception] end end |
#start_dump ⇒ Object
64 65 66 67 |
# File 'lib/fivemat/rspec.rb', line 64 def start_dump # Skip the call to output.puts in the messiest way possible. self.class.superclass.superclass.instance_method(:start_dump).bind(self).call end |