rspec-instafail 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +3 -3
- data/VERSION +1 -1
- data/lib/rspec/instafail/rspec_2.rb +3 -0
- data/rspec-instafail.gemspec +2 -2
- data/spec/instafail_spec.rb +46 -21
- data/spec/rspec_2/a_test.rb +17 -3
- metadata +4 -4
data/Readme.md
CHANGED
@@ -42,8 +42,8 @@ Authors
|
|
42
42
|
- [Jeff Kreeftmeijer](http://jeffkreeftmeijer.com)
|
43
43
|
- [Steve Tooke](http://tooky.github.com)
|
44
44
|
- [Josh Ellithorpe](https://github.com/zquestz)
|
45
|
+
- [Raphael Sofaer](https://github.com/rsofaer)
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
grosser.michael@gmail.com
|
47
|
+
[Michael Grosser](http://grosser.it)<br/>
|
48
|
+
michael@grosser.it<br/>
|
49
49
|
Hereby placed under public domain, do what you want, just do not hold me accountable...
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -15,6 +15,9 @@ module RSpec
|
|
15
15
|
output.puts "#{short_padding}#{@counter}) #{example.full_description}"
|
16
16
|
output.puts "#{padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
|
17
17
|
output.puts "#{padding}#{red(exception)}"
|
18
|
+
if exception.respond_to?(:original_exception)
|
19
|
+
output.puts "#{padding}#{red(exception.original_exception)}"
|
20
|
+
end
|
18
21
|
format_backtrace(exception.backtrace, example).each do |backtrace_info|
|
19
22
|
output.puts grey("#{padding}# #{backtrace_info}")
|
20
23
|
end
|
data/rspec-instafail.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
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.7"
|
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{2011-
|
12
|
+
s.date = %q{2011-03-06}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.files = [
|
15
15
|
"Rakefile",
|
data/spec/instafail_spec.rb
CHANGED
@@ -23,37 +23,63 @@ EXP
|
|
23
23
|
output.should =~ Regexp.new(expected_output, 'x')
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
context 'Rspec 2.x' do
|
27
|
+
before(:all)do
|
28
|
+
@rspec_result = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color`
|
29
|
+
end
|
30
|
+
before do
|
31
|
+
@output = @rspec_result.dup
|
32
|
+
end
|
33
|
+
|
34
|
+
it "outputs logical failures" do
|
35
|
+
expected = <<EXP
|
36
|
+
1\\) x fails logically
|
30
37
|
Failure\\/Error: 1\\.should == 2
|
31
38
|
expected: 2,
|
32
39
|
got: 1 \\(using ==\\)
|
33
40
|
EXP
|
34
|
-
|
41
|
+
@output.should =~ Regexp.new(expected, 'x')
|
35
42
|
|
36
|
-
|
43
|
+
@output.should include('/a_test.rb:5')
|
44
|
+
end
|
37
45
|
|
38
|
-
|
39
|
-
|
46
|
+
it 'outputs a simple error' do
|
47
|
+
expected = <<EXP
|
48
|
+
\\.\\.\\*
|
49
|
+
2\\) x raises a simple error
|
50
|
+
Failure\\/Error: raise 'shallow failure'
|
51
|
+
shallow failure
|
52
|
+
EXP
|
53
|
+
@output.should =~ Regexp.new(expected, 'x')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'outputs an error which responds to original_exception' do
|
57
|
+
expected = <<EXP
|
58
|
+
3\\) x raises a hidden error
|
59
|
+
Failure\\/Error: raise error
|
60
|
+
There is an error in this error\\.
|
61
|
+
There is no error in this error\\.
|
62
|
+
EXP
|
63
|
+
@output.should =~ Regexp.new(expected, 'x')
|
64
|
+
end
|
65
|
+
it 'outputs the remaining passing specs and the ending block' do
|
66
|
+
expected = <<EXP
|
67
|
+
\\.
|
40
68
|
|
41
69
|
Pending:
|
42
|
-
x
|
70
|
+
x pends
|
43
71
|
# No reason given
|
44
72
|
# \\./a_test\\.rb:14
|
45
73
|
|
46
74
|
Finished in \\d\\.\\d+ seconds
|
47
|
-
|
75
|
+
7 examples, 3 failures, 1 pending
|
48
76
|
EXP
|
49
|
-
|
77
|
+
@output.should =~ Regexp.new(expected, 'x')
|
78
|
+
end
|
50
79
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
pending 'the backtrace for the error is always absolute on my machine'
|
55
|
-
output = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color`
|
56
|
-
expected_output = <<EXP
|
80
|
+
it "works correctly with RSpec 2.x" do
|
81
|
+
pending 'the backtrace for the error is always absolute on my machine'
|
82
|
+
expected_output = <<EXP
|
57
83
|
1\\) x a
|
58
84
|
Failure\\/Error: 1\\.should == 2
|
59
85
|
expected: 2,
|
@@ -67,11 +93,10 @@ Pending:
|
|
67
93
|
# \\./a_test\\.rb:14
|
68
94
|
|
69
95
|
Finished in \\d\\.\\d+ seconds
|
70
|
-
|
96
|
+
7 examples, 3 failures, 1 pending
|
71
97
|
EXP
|
72
|
-
|
73
|
-
|
74
|
-
|
98
|
+
@output.should =~ Regexp.new(expected_output, 'x')
|
99
|
+
end
|
75
100
|
end
|
76
101
|
end
|
77
102
|
|
data/spec/rspec_2/a_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rspec', 'instafail'))
|
2
2
|
|
3
3
|
describe 'x' do
|
4
|
-
it '
|
4
|
+
it 'fails logically' do
|
5
5
|
1.should == 2
|
6
6
|
end
|
7
7
|
|
@@ -11,11 +11,25 @@ describe 'x' do
|
|
11
11
|
it 'c' do
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'pends' do
|
15
15
|
pending
|
16
16
|
raise
|
17
17
|
end
|
18
18
|
|
19
|
+
it 'raises a simple error' do
|
20
|
+
raise 'shallow failure'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'raises a hidden error' do
|
24
|
+
error = ExceptionWrappingException.new('There is an error in this error.')
|
25
|
+
error.original_exception = RuntimeError.new('There is no error in this error.')
|
26
|
+
raise error
|
27
|
+
end
|
28
|
+
|
19
29
|
it 'e' do
|
20
30
|
end
|
21
|
-
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class ExceptionWrappingException < RuntimeError
|
34
|
+
attr_accessor :original_exception
|
35
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-instafail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-06 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|