rspec-instafail 0.1.3 → 0.1.4
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.
- data/Readme.md +1 -0
- data/VERSION +1 -1
- data/lib/rspec/instafail.rb +5 -49
- data/lib/rspec/instafail/rspec_1.rb +27 -0
- data/lib/rspec/instafail/rspec_2.rb +21 -0
- data/rspec-instafail.gemspec +4 -2
- data/spec/instafail_spec.rb +3 -8
- metadata +5 -3
data/Readme.md
CHANGED
@@ -40,6 +40,7 @@ Authors
|
|
40
40
|
### [Contributors](http://github.com/grosser/rspec-instafail/contributors)
|
41
41
|
- [Matthew Willhite](http://github.com/miwillhite)
|
42
42
|
- [Jeff Kreeftmeijer](http://jeffkreeftmeijer.com)
|
43
|
+
- [Steve Tooke](http://tooky.github.com)
|
43
44
|
|
44
45
|
|
45
46
|
[Michael Grosser](http://pragmatig.wordpress.com)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/rspec/instafail.rb
CHANGED
@@ -1,53 +1,9 @@
|
|
1
1
|
module RSpec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def example_failed(example, counter, failure)
|
7
|
-
short_padding = ' '
|
8
|
-
padding = ' '
|
9
|
-
|
10
|
-
output.puts
|
11
|
-
output.puts red("#{short_padding}#{counter}) #{example_group.description} #{example.description}")
|
12
|
-
output.puts "#{padding}#{red(failure.exception)}"
|
13
|
-
|
14
|
-
format_backtrace(failure.exception.backtrace).each do |backtrace_info|
|
15
|
-
output.puts insta_gray("#{padding}# #{backtrace_info.strip}")
|
16
|
-
end
|
17
|
-
|
18
|
-
output.flush
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
# there is a gray() that returns nil, so we use our own...
|
24
|
-
def insta_gray(text)
|
25
|
-
colour(text, "\e[90m")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
Instafail
|
29
|
-
else
|
30
|
-
# rspec 2.x
|
31
|
-
require 'rspec/core/formatters/progress_formatter'
|
32
|
-
class Instafail < RSpec::Core::Formatters::ProgressFormatter
|
33
|
-
def example_failed(example)
|
34
|
-
@counter ||= 0
|
35
|
-
@counter += 1
|
36
|
-
exception = example.metadata[:execution_result][:exception_encountered]
|
37
|
-
short_padding = ' '
|
38
|
-
padding = ' '
|
39
|
-
output.puts
|
40
|
-
output.puts "#{short_padding}#{@counter}) #{example.full_description}"
|
41
|
-
output.puts "#{padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
|
42
|
-
output.puts "#{padding}#{red(exception)}"
|
43
|
-
format_backtrace(exception.backtrace, example).each do |backtrace_info|
|
44
|
-
output.puts grey("#{padding}# #{backtrace_info}")
|
45
|
-
end
|
46
|
-
output.flush
|
47
|
-
end
|
48
|
-
end
|
49
|
-
Instafail
|
2
|
+
begin
|
3
|
+
require 'rspec/instafail/rspec_2'
|
4
|
+
rescue LoadError => try_rspec_1
|
5
|
+
require 'rspec/instafail/rspec_1'
|
50
6
|
end
|
51
7
|
|
52
|
-
|
8
|
+
Instafail::VERSION = File.read( File.join(File.dirname(__FILE__),'..','..','VERSION') ).strip
|
53
9
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec/runner/formatter/progress_bar_formatter'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
class Instafail < Spec::Runner::Formatter::ProgressBarFormatter
|
5
|
+
def example_failed(example, counter, failure)
|
6
|
+
short_padding = ' '
|
7
|
+
padding = ' '
|
8
|
+
|
9
|
+
output.puts
|
10
|
+
output.puts red("#{short_padding}#{counter}) #{example_group.description} #{example.description}")
|
11
|
+
output.puts "#{padding}#{red(failure.exception)}"
|
12
|
+
|
13
|
+
[*format_backtrace(failure.exception.backtrace)].each do |backtrace_info|
|
14
|
+
output.puts insta_gray("#{padding}# #{backtrace_info.strip}")
|
15
|
+
end
|
16
|
+
|
17
|
+
output.flush
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# there is a gray() that returns nil, so we use our own...
|
23
|
+
def insta_gray(text)
|
24
|
+
colour(text, "\e[90m")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rspec/core/formatters/progress_formatter'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
class Instafail < RSpec::Core::Formatters::ProgressFormatter
|
5
|
+
def example_failed(example)
|
6
|
+
@counter ||= 0
|
7
|
+
@counter += 1
|
8
|
+
exception = example.metadata[:execution_result][:exception_encountered]
|
9
|
+
short_padding = ' '
|
10
|
+
padding = ' '
|
11
|
+
output.puts
|
12
|
+
output.puts "#{short_padding}#{@counter}) #{example.full_description}"
|
13
|
+
output.puts "#{padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
|
14
|
+
output.puts "#{padding}#{red(exception)}"
|
15
|
+
format_backtrace(exception.backtrace, example).each do |backtrace_info|
|
16
|
+
output.puts grey("#{padding}# #{backtrace_info}")
|
17
|
+
end
|
18
|
+
output.flush
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/rspec-instafail.gemspec
CHANGED
@@ -5,17 +5,19 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-instafail}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-17}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.files = [
|
15
15
|
"Rakefile",
|
16
16
|
"Readme.md",
|
17
17
|
"VERSION",
|
18
18
|
"lib/rspec/instafail.rb",
|
19
|
+
"lib/rspec/instafail/rspec_1.rb",
|
20
|
+
"lib/rspec/instafail/rspec_2.rb",
|
19
21
|
"rspec-instafail.gemspec",
|
20
22
|
"spec/instafail_spec.rb",
|
21
23
|
"spec/rspec_1/Gemfile",
|
data/spec/instafail_spec.rb
CHANGED
@@ -5,27 +5,22 @@ describe 'RSpec::Instafail' do
|
|
5
5
|
1\\) x a
|
6
6
|
expected: 2,
|
7
7
|
got: 1 \\(using ==\\)
|
8
|
-
# \\.\\/a_test\\.rb:5:
|
8
|
+
# (\\.\\/)?a_test\\.rb:5:(in `block \\(2 levels\\) in <top \\(required\\)>')?
|
9
9
|
\\.\\.\\*\\.
|
10
10
|
|
11
11
|
Pending:
|
12
12
|
|
13
13
|
x d \\(TODO\\)
|
14
|
-
\\.\\/a_test\\.rb:14
|
14
|
+
(\\.\\/)?a_test\\.rb:14(\:in `block in <top \\(required\\)>')?
|
15
15
|
|
16
16
|
1\\)
|
17
17
|
'x a' FAILED
|
18
18
|
expected: 2,
|
19
19
|
got: 1 \\(using ==\\)
|
20
|
-
\\./a_test\\.rb:5:
|
21
|
-
|
22
|
-
Finished in \\d\\.\\d+ seconds
|
23
|
-
|
24
|
-
5 examples, 1 failure, 1 pending
|
20
|
+
(\\./)?a_test\\.rb:5:(in `block \\(2 levels\\) in <top \\(required\\)>')?
|
25
21
|
EXP
|
26
22
|
|
27
23
|
output.should =~ Regexp.new(expected_output, 'x')
|
28
|
-
|
29
24
|
end
|
30
25
|
|
31
26
|
it "works correctly with RSpec 2.x (but backtrace might be broken)" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-17 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -31,6 +31,8 @@ files:
|
|
31
31
|
- Readme.md
|
32
32
|
- VERSION
|
33
33
|
- lib/rspec/instafail.rb
|
34
|
+
- lib/rspec/instafail/rspec_1.rb
|
35
|
+
- lib/rspec/instafail/rspec_2.rb
|
34
36
|
- rspec-instafail.gemspec
|
35
37
|
- spec/instafail_spec.rb
|
36
38
|
- spec/rspec_1/Gemfile
|