rspec-instafail 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -45,6 +45,7 @@ Authors
45
45
  - [Raphael Sofaer](https://github.com/rsofaer)
46
46
  - [Mike Mazur](https://github.com/mikem)
47
47
  - [vernonR2](https://github.com/vernonR2)
48
+ - [Olek Janiszewski](https://github.com/exviva)
48
49
 
49
50
  [Michael Grosser](http://grosser.it)<br/>
50
51
  michael@grosser.it<br/>
@@ -12,16 +12,26 @@ module RSpec
12
12
  dump_backtrace(example)
13
13
  end
14
14
 
15
+ private
16
+
15
17
  def _dump_pending_example(example, index)
16
18
  if defined? pending_fixed? # > 2.8
17
19
  if pending_fixed?(example)
18
20
  dump_pending_fixed(example, index)
19
21
  else
20
- dump_failure(example, index)
22
+ preserve_size(example.example_group.ancestors) do
23
+ dump_failure(example, index)
24
+ end
21
25
  end
22
26
  else
23
27
  dump_pending_example_fixed(example, index) || dump_failure(example, index)
24
28
  end
25
29
  end
30
+
31
+ def preserve_size(array)
32
+ old = array.size
33
+ yield
34
+ array.pop if array.size > old
35
+ end
26
36
  end
27
37
  end
@@ -1,2 +1,2 @@
1
1
  require 'rspec/instafail'
2
- RSpec::Instafail::VERSION = '0.2.2'
2
+ RSpec::Instafail::VERSION = '0.2.3'
@@ -39,7 +39,12 @@ describe 'RSpec::Instafail' do
39
39
  end
40
40
 
41
41
  it 'outputs the the ending block' do
42
- @output.should =~ /Finished in \d\.\d+ seconds\s*7 examples, 3 failures, 1 pending/
42
+ @output.should =~ /Finished in \d\.\d+ seconds\s*9 examples, 4 failures, 1 pending/
43
+ end
44
+
45
+ it "does not add ancestors after failures" do
46
+ @output.should include('ANCESTORS:2')
47
+ @output.should_not include('ANCESTORS:3')
43
48
  end
44
49
  end
45
50
  end
@@ -28,6 +28,19 @@ describe 'x' do
28
28
 
29
29
  it 'e' do
30
30
  end
31
+
32
+ context "ancestors" do
33
+ after do
34
+ puts "ANCESTORS:#{example.example_group.ancestors.size}"
35
+ end
36
+
37
+ it "does not add ancestors on failure" do
38
+ raise "BAM"
39
+ end
40
+
41
+ it "does not add ancestors on failure" do
42
+ end
43
+ end
31
44
  end
32
45
 
33
46
  class ExceptionWrappingException < RuntimeError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-instafail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-08 00:00:00.000000000 Z
12
+ date: 2012-03-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  requirements: []
54
54
  rubyforge_project:
55
- rubygems_version: 1.8.10
55
+ rubygems_version: 1.8.15
56
56
  signing_key:
57
57
  specification_version: 3
58
58
  summary: Show failing specs instantly