guard-rspec 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +0,0 @@
1
- # Inspired from https://github.com/grosser/rspec-instafail/blob/master/lib/rspec/instafail.rb
2
- require "#{File.dirname(__FILE__)}/../formatter"
3
- require 'rspec/core/formatters/progress_formatter'
4
-
5
- class InstafailRSpec < RSpec::Core::Formatters::ProgressFormatter
6
- include Formatter
7
-
8
- def dump_summary(duration, total, failures, pending)
9
- super # needed to keep progress formatter
10
-
11
- message = guard_message(total, failures, pending, duration)
12
- image = guard_image(failures, pending)
13
- notify(message, image)
14
- end
15
-
16
- def example_failed(example)
17
- @counter ||= 0
18
- @counter += 1
19
- result = example.metadata[:execution_result]
20
- exception = result[:exception_encountered] || result[:exception] # rspec 2.0 || rspec 2.2
21
- short_padding = ' '
22
- padding = ' '
23
- output.puts
24
- output.puts "#{short_padding}#{@counter}) #{example.full_description}"
25
- output.puts "#{padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
26
- output.puts "#{padding}#{red(exception)}"
27
- format_backtrace(exception.backtrace, example).each do |backtrace_info|
28
- output.puts grey("#{padding}# #{backtrace_info}")
29
- end
30
- output.flush
31
- end
32
-
33
- end
@@ -1,35 +0,0 @@
1
- # Inspired from https://github.com/grosser/rspec-instafail/blob/master/lib/rspec/instafail.rb
2
- require "#{File.dirname(__FILE__)}/../formatter"
3
- require 'spec/runner/formatter/progress_bar_formatter'
4
-
5
- class InstafailSpec < Spec::Runner::Formatter::ProgressBarFormatter
6
- include Formatter
7
-
8
- def dump_summary(duration, total, failures, pending)
9
- message = guard_message(total, failures, pending, duration)
10
- image = guard_image(failures, pending)
11
- notify(message, image)
12
- end
13
-
14
- def example_failed(example, counter, failure)
15
- short_padding = ' '
16
- padding = ' '
17
-
18
- output.puts
19
- output.puts red("#{short_padding}#{counter}) #{example_group.description} #{example.description}")
20
- output.puts "#{padding}#{red(failure.exception)}"
21
-
22
- format_backtrace(failure.exception.backtrace).each do |backtrace_info|
23
- output.puts insta_gray("#{padding}# #{backtrace_info.strip}")
24
- end
25
-
26
- output.flush
27
- end
28
-
29
- private
30
-
31
- # there is a gray() that returns nil, so we use our own...
32
- def insta_gray(text)
33
- colour(text, "\e[90m")
34
- end
35
- end