rspec-instafail 0.2.4 → 0.2.5
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.
- checksums.yaml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +28 -0
- data/Rakefile +8 -21
- data/Readme.md +3 -1
- data/lib/rspec/instafail.rb +8 -4
- data/lib/rspec/instafail/rspec_3.rb +18 -0
- data/lib/rspec/instafail/version.rb +1 -1
- data/rspec-instafail.gemspec +5 -2
- data/spec/instafail_spec.rb +35 -3
- data/spec/rspec_1/Gemfile +1 -1
- data/spec/rspec_1/Gemfile.lock +2 -0
- data/spec/rspec_2/Gemfile +1 -0
- data/spec/rspec_2/Gemfile.lock +1 -0
- data/spec/rspec_3/Gemfile +2 -0
- data/spec/rspec_3/Gemfile.lock +22 -0
- data/spec/rspec_3/a_test.rb +48 -0
- metadata +28 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6eb29bfc65fc9c1f90984aad635ff1336244302d
|
4
|
+
data.tar.gz: d30d2017dadd2ce70327a241fd07398758c9ef0e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a030d26ea854b703e8441b8ff0f4662b8d9a261e90608b24111f5e5f0d8c57534343b1f5303261e6a6af512177a75433a706fb951b3091b3f68c6b2e883a2f3
|
7
|
+
data.tar.gz: 88f838d2387dd0448f78a23030ece2cb09d4bc5b3206aa6c766a72ce78c2a4021fe8e28dc42365f3621810da5141f9e4e4ecf6c668e739635cc5246ea9748243
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec-instafail (0.2.5)
|
5
|
+
rspec
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
bump (0.4.0)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
rake (10.0.3)
|
13
|
+
rspec (2.99.0)
|
14
|
+
rspec-core (~> 2.99.0)
|
15
|
+
rspec-expectations (~> 2.99.0)
|
16
|
+
rspec-mocks (~> 2.99.0)
|
17
|
+
rspec-core (2.99.0)
|
18
|
+
rspec-expectations (2.99.0)
|
19
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
20
|
+
rspec-mocks (2.99.0)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bump
|
27
|
+
rake
|
28
|
+
rspec-instafail!
|
data/Rakefile
CHANGED
@@ -1,25 +1,12 @@
|
|
1
|
-
require "bundler"
|
2
|
-
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "bump/tasks"
|
3
4
|
|
4
5
|
task :default do
|
5
|
-
|
6
|
-
|
6
|
+
Bundler.with_clean_env do
|
7
|
+
sh "cd spec/rspec_1 && (bundle check || bundle) > /dev/null"
|
8
|
+
sh "cd spec/rspec_2 && (bundle check || bundle) > /dev/null"
|
9
|
+
sh "cd spec/rspec_3 && (bundle check || bundle) > /dev/null"
|
10
|
+
end
|
7
11
|
sh "rspec spec/"
|
8
12
|
end
|
9
|
-
|
10
|
-
rule /^version:bump:.*/ do |t|
|
11
|
-
file = 'lib/rspec/instafail/version.rb'
|
12
|
-
|
13
|
-
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
|
14
|
-
index = ['major', 'minor','patch'].index(t.name.split(':').last)
|
15
|
-
|
16
|
-
version_file = File.read(file)
|
17
|
-
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
|
18
|
-
version_parts[index] = version_parts[index].to_i + 1
|
19
|
-
version_parts[2] = 0 if index < 2
|
20
|
-
version_parts[1] = 0 if index < 1
|
21
|
-
new_version = version_parts * '.'
|
22
|
-
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
23
|
-
|
24
|
-
sh "git add #{file} && git commit -m 'bump version to #{new_version}'"
|
25
|
-
end
|
data/Readme.md
CHANGED
data/lib/rspec/instafail.rb
CHANGED
@@ -4,10 +4,14 @@ module RSpec
|
|
4
4
|
lib = File.expand_path(File.dirname(File.dirname(__FILE__)))
|
5
5
|
$LOAD_PATH << lib unless $LOAD_PATH.include?(lib)
|
6
6
|
|
7
|
-
|
8
|
-
require "rspec/instafail/
|
9
|
-
|
10
|
-
|
7
|
+
if defined?(::RSpec::Core) && ::RSpec::Core::Version::STRING >= '3.0.0'
|
8
|
+
require "rspec/instafail/rspec_3"
|
9
|
+
else
|
10
|
+
begin
|
11
|
+
require "rspec/instafail/rspec_2"
|
12
|
+
rescue LoadError # try rspec 1
|
13
|
+
require "rspec/instafail/rspec_1"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
require 'rspec/instafail/version'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rspec/core/formatters/progress_formatter'
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
class Instafail < RSpec::Core::Formatters::ProgressFormatter
|
5
|
+
RSpec::Core::Formatters.register self, :example_failed
|
6
|
+
|
7
|
+
def initialize(output)
|
8
|
+
super
|
9
|
+
@output = output
|
10
|
+
@failed_examples = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def example_failed(failure)
|
14
|
+
@failed_examples << failure.example
|
15
|
+
@output.puts failure.fully_formatted(@failed_examples.size)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'rspec/instafail'
|
2
|
-
RSpec::Instafail::VERSION = '0.2.
|
2
|
+
RSpec::Instafail::VERSION = '0.2.5'
|
data/rspec-instafail.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
2
2
|
name = 'rspec-instafail'
|
3
|
-
require "rspec/instafail/version"
|
4
3
|
|
5
|
-
|
4
|
+
# needs rspec installed to load the version, so let's avoid this mess
|
5
|
+
version = File.read("lib/rspec/instafail/version.rb")[/\d+\.\d+\.\d+/]
|
6
|
+
|
7
|
+
Gem::Specification.new name, version do |s|
|
6
8
|
s.summary = "Show failing specs instantly"
|
7
9
|
s.authors = ["Michael Grosser"]
|
8
10
|
s.email = "michael@grosser.it"
|
9
11
|
s.homepage = "http://github.com/grosser/#{name}"
|
10
12
|
s.files = `git ls-files`.split("\n")
|
11
13
|
s.license = "MIT"
|
14
|
+
s.add_runtime_dependency "rspec"
|
12
15
|
end
|
data/spec/instafail_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
describe 'RSpec::Instafail' do
|
2
2
|
context "RSpec 1.x" do
|
3
3
|
before :all do
|
4
|
-
|
4
|
+
Bundler.with_clean_env do
|
5
|
+
@rspec_result = `cd spec/rspec_1 && bundle exec spec a_test.rb --format RSpec::Instafail`
|
6
|
+
end
|
5
7
|
end
|
6
8
|
|
7
9
|
before do
|
@@ -23,7 +25,9 @@ describe 'RSpec::Instafail' do
|
|
23
25
|
|
24
26
|
context 'Rspec 2.x' do
|
25
27
|
before :all do
|
26
|
-
|
28
|
+
Bundler.with_clean_env do
|
29
|
+
@rspec_result = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color --order default`
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
before do
|
@@ -47,5 +51,33 @@ describe 'RSpec::Instafail' do
|
|
47
51
|
@output.should_not include('ANCESTORS:3')
|
48
52
|
end
|
49
53
|
end
|
50
|
-
end
|
51
54
|
|
55
|
+
context 'Rspec 3.x' do
|
56
|
+
before :all do
|
57
|
+
Bundler.with_clean_env do
|
58
|
+
@rspec_result = `cd spec/rspec_3 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color --order default`
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
before do
|
63
|
+
@output = @rspec_result.dup
|
64
|
+
end
|
65
|
+
|
66
|
+
it "outputs failures at start of output" do
|
67
|
+
@output.should =~ /^\s+1\) x fails logically/m
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'outputs errors in middle of output' do
|
71
|
+
@output.should =~ /\.\.\*\s*2\) x raises a simple error/m
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'outputs the the ending block' do
|
75
|
+
@output.should =~ /Finished in \d\.\d+ seconds.*\s*9 examples, 4 failures, 1 pending/
|
76
|
+
end
|
77
|
+
|
78
|
+
it "does not add ancestors after failures" do
|
79
|
+
@output.should include('ANCESTORS:18')
|
80
|
+
@output.should_not include('ANCESTORS:19')
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/spec/rspec_1/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
|
-
gem 'rspec', '1.3.0'
|
2
|
+
gem 'rspec', '1.3.0'
|
data/spec/rspec_1/Gemfile.lock
CHANGED
data/spec/rspec_2/Gemfile
CHANGED
data/spec/rspec_2/Gemfile.lock
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.2.5)
|
5
|
+
rspec (3.0.0)
|
6
|
+
rspec-core (~> 3.0.0)
|
7
|
+
rspec-expectations (~> 3.0.0)
|
8
|
+
rspec-mocks (~> 3.0.0)
|
9
|
+
rspec-core (3.0.0)
|
10
|
+
rspec-support (~> 3.0.0)
|
11
|
+
rspec-expectations (3.0.0)
|
12
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
13
|
+
rspec-support (~> 3.0.0)
|
14
|
+
rspec-mocks (3.0.0)
|
15
|
+
rspec-support (~> 3.0.0)
|
16
|
+
rspec-support (3.0.0)
|
17
|
+
|
18
|
+
PLATFORMS
|
19
|
+
ruby
|
20
|
+
|
21
|
+
DEPENDENCIES
|
22
|
+
rspec (>= 3.0)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rspec', 'instafail'))
|
2
|
+
|
3
|
+
describe 'x' do
|
4
|
+
it 'fails logically' do
|
5
|
+
expect(1).to eq 2
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'b' do
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'c' do
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'pends' do
|
15
|
+
pending
|
16
|
+
raise
|
17
|
+
end
|
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
|
+
|
29
|
+
it 'e' do
|
30
|
+
end
|
31
|
+
|
32
|
+
context "ancestors" do
|
33
|
+
after do |example|
|
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
|
44
|
+
end
|
45
|
+
|
46
|
+
class ExceptionWrappingException < RuntimeError
|
47
|
+
attr_accessor :original_exception
|
48
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-instafail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Grosser
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
14
27
|
description:
|
15
28
|
email: michael@grosser.it
|
16
29
|
executables: []
|
17
30
|
extensions: []
|
18
31
|
extra_rdoc_files: []
|
19
32
|
files:
|
33
|
+
- Gemfile
|
34
|
+
- Gemfile.lock
|
20
35
|
- Rakefile
|
21
36
|
- Readme.md
|
22
37
|
- lib/rspec/instafail.rb
|
23
38
|
- lib/rspec/instafail/rspec_1.rb
|
24
39
|
- lib/rspec/instafail/rspec_2.rb
|
40
|
+
- lib/rspec/instafail/rspec_3.rb
|
25
41
|
- lib/rspec/instafail/version.rb
|
26
42
|
- rspec-instafail.gemspec
|
27
43
|
- spec/instafail_spec.rb
|
@@ -31,29 +47,31 @@ files:
|
|
31
47
|
- spec/rspec_2/Gemfile
|
32
48
|
- spec/rspec_2/Gemfile.lock
|
33
49
|
- spec/rspec_2/a_test.rb
|
50
|
+
- spec/rspec_3/Gemfile
|
51
|
+
- spec/rspec_3/Gemfile.lock
|
52
|
+
- spec/rspec_3/a_test.rb
|
34
53
|
homepage: http://github.com/grosser/rspec-instafail
|
35
54
|
licenses:
|
36
55
|
- MIT
|
56
|
+
metadata: {}
|
37
57
|
post_install_message:
|
38
58
|
rdoc_options: []
|
39
59
|
require_paths:
|
40
60
|
- lib
|
41
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
62
|
requirements:
|
44
|
-
- -
|
63
|
+
- - ">="
|
45
64
|
- !ruby/object:Gem::Version
|
46
65
|
version: '0'
|
47
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
67
|
requirements:
|
50
|
-
- -
|
68
|
+
- - ">="
|
51
69
|
- !ruby/object:Gem::Version
|
52
70
|
version: '0'
|
53
71
|
requirements: []
|
54
72
|
rubyforge_project:
|
55
|
-
rubygems_version:
|
73
|
+
rubygems_version: 2.2.2
|
56
74
|
signing_key:
|
57
|
-
specification_version:
|
75
|
+
specification_version: 4
|
58
76
|
summary: Show failing specs instantly
|
59
77
|
test_files: []
|