rspec_org_formatter 0.2.2 → 0.2.3
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/.gitignore +3 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +28 -0
- data/README.md +3 -2
- data/Rakefile +24 -0
- data/lib/rspec/core/formatters/org_formatter.rb +26 -13
- data/rspec_org_formatter.gemspec +18 -0
- metadata +78 -5
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec_org_formatter (0.2.3)
|
5
|
+
rspec (>= 2.6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
rake (0.9.6)
|
12
|
+
rspec (2.12.0)
|
13
|
+
rspec-core (~> 2.12.0)
|
14
|
+
rspec-expectations (~> 2.12.0)
|
15
|
+
rspec-mocks (~> 2.12.0)
|
16
|
+
rspec-core (2.12.2)
|
17
|
+
rspec-expectations (2.12.1)
|
18
|
+
diff-lcs (~> 1.1.3)
|
19
|
+
rspec-mocks (2.12.2)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
bundler (~> 1.0)
|
26
|
+
rake (~> 0.8)
|
27
|
+
rspec (~> 2.4)
|
28
|
+
rspec_org_formatter!
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Install the gem:
|
|
10
10
|
|
11
11
|
Use it:
|
12
12
|
|
13
|
-
rspec
|
13
|
+
rspec -f RspecOrgFormatter --out rspec.org
|
14
14
|
|
15
15
|
You'll get an org file with your results in it.
|
16
16
|
|
@@ -20,9 +20,10 @@ Add it to your Gemfile if you're using [Bundler][bundler].
|
|
20
20
|
|
21
21
|
In your .rspec, usually alongside another formatter, add:
|
22
22
|
|
23
|
-
|
23
|
+
-f RspecOrgFormatter
|
24
24
|
--out rspec.org
|
25
25
|
|
26
|
+
|
26
27
|
## License
|
27
28
|
|
28
29
|
The MIT License, see [LICENSE][license].
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require "bundler/gem_tasks"
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'bundler'
|
9
|
+
rescue LoadError => e
|
10
|
+
warn e.message
|
11
|
+
warn "Run `gem install bundler` to install Bundler."
|
12
|
+
exit -1
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
Bundler.setup(:development)
|
17
|
+
rescue Bundler::BundlerError => e
|
18
|
+
warn e.message
|
19
|
+
warn "Run `bundle install` to install missing gems."
|
20
|
+
exit e.status_code
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
task :default => :build
|
@@ -1,12 +1,18 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
3
3
|
|
4
|
+
class NilClass
|
5
|
+
def blank?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
class String
|
5
11
|
def blank?
|
6
12
|
!self.match(/\A\s+\z/).nil?
|
7
13
|
end
|
8
14
|
end
|
9
|
-
|
15
|
+
|
10
16
|
module RSpec
|
11
17
|
module Core
|
12
18
|
module Formatters
|
@@ -14,6 +20,7 @@ module RSpec
|
|
14
20
|
|
15
21
|
def initialize(output)
|
16
22
|
super(output)
|
23
|
+
@group_level = 1
|
17
24
|
end
|
18
25
|
|
19
26
|
private
|
@@ -22,11 +29,12 @@ module RSpec
|
|
22
29
|
end
|
23
30
|
protected
|
24
31
|
def section_level(example_or_group)
|
25
|
-
if example_or_group.respond_to? :ancestors
|
26
|
-
|
27
|
-
else
|
28
|
-
|
29
|
-
end
|
32
|
+
# if example_or_group.respond_to? :ancestors
|
33
|
+
# example_or_group.ancestors.size
|
34
|
+
# else
|
35
|
+
# example_or_group.example_group.ancestors.size + 1
|
36
|
+
# end
|
37
|
+
@group_level
|
30
38
|
end
|
31
39
|
# returs a string containing the right amount of * for an org section title
|
32
40
|
# relative to an example or example_group
|
@@ -43,7 +51,7 @@ module RSpec
|
|
43
51
|
# returns the first line of the exception message text
|
44
52
|
def exception_message_head (exception)
|
45
53
|
nl = exception.message.index(?\n)
|
46
|
-
if nl
|
54
|
+
if nl
|
47
55
|
exception.message.slice(0, nl)
|
48
56
|
else
|
49
57
|
exception.message
|
@@ -59,7 +67,7 @@ module RSpec
|
|
59
67
|
nil
|
60
68
|
end
|
61
69
|
end
|
62
|
-
|
70
|
+
|
63
71
|
# outputs an exception
|
64
72
|
def output_exception(exception, example)
|
65
73
|
@output.puts "#{section_indent example} #{exception_message_head exception}" unless exception.nil?
|
@@ -79,9 +87,9 @@ module RSpec
|
|
79
87
|
# outputs the backtrace of an exception
|
80
88
|
def output_backtrace(exception, example)
|
81
89
|
if (exception)
|
82
|
-
@output.puts "#{section_indent example} *Backtrace*"
|
90
|
+
@output.puts "#{section_indent example} *Backtrace*"
|
83
91
|
fmtbktr = format_backtrace exception.backtrace, example
|
84
|
-
fmtbktr.each { |bktr|
|
92
|
+
fmtbktr.each { |bktr|
|
85
93
|
file, line, rest = bktr.match(/(.*):(.*):(in.*)/).to_a.drop(1)
|
86
94
|
if file.index('./') == 0
|
87
95
|
file = file[1..-1]
|
@@ -105,7 +113,7 @@ module RSpec
|
|
105
113
|
RSpec::Core::PendingExampleFixedError === exception
|
106
114
|
end
|
107
115
|
end
|
108
|
-
|
116
|
+
|
109
117
|
|
110
118
|
public
|
111
119
|
def message(message)
|
@@ -123,8 +131,13 @@ module RSpec
|
|
123
131
|
super(example_group)
|
124
132
|
@output.puts "#{section_markup example_group} #{example_group.description}"
|
125
133
|
@output.flush
|
134
|
+
@group_level += 1
|
126
135
|
end
|
127
136
|
|
137
|
+
def example_group_finished(example_group)
|
138
|
+
super(example_group)
|
139
|
+
@group_level -= 1
|
140
|
+
end
|
128
141
|
def start_dump
|
129
142
|
end
|
130
143
|
|
@@ -135,7 +148,7 @@ module RSpec
|
|
135
148
|
|
136
149
|
|
137
150
|
|
138
|
-
|
151
|
+
|
139
152
|
def example_failed(example)
|
140
153
|
super(example)
|
141
154
|
exception = example.metadata[:execution_result][:exception]
|
@@ -183,7 +196,7 @@ module RSpec
|
|
183
196
|
@output.puts "#+TODO: FAILED PENDING_FIXED PENDING | SUCCESS"
|
184
197
|
@output.flush
|
185
198
|
end
|
186
|
-
|
199
|
+
|
187
200
|
end
|
188
201
|
end
|
189
202
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'rspec_org_formatter'
|
3
|
+
s.version = '0.2.3'
|
4
|
+
s.date = '2012-01-07'
|
5
|
+
s.summary = "RSpec Org Formatter"
|
6
|
+
s.description = "RSpec results meant to be viewed in an emacs org buffer"
|
7
|
+
s.authors = ['Alessandro Piras']
|
8
|
+
s.email = 'laynor@gmail.com'
|
9
|
+
s.files = `git ls-files`.split($/)
|
10
|
+
s.add_dependency "rspec", ">= 2.6.0"
|
11
|
+
s.require_path = 'lib'
|
12
|
+
s.homepage = 'https://github.com/laynor/rspec_org_formatter'
|
13
|
+
s.add_development_dependency 'bundler', '~> 1.0'
|
14
|
+
s.add_development_dependency 'rake', '~> 0.8'
|
15
|
+
s.add_development_dependency 'rspec', '~> 2.4'
|
16
|
+
s.add_development_dependency 'rspec_org_formatter', '~> 0.2.2'
|
17
|
+
end
|
18
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_org_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,16 +27,84 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 2.6.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.8'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.4'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.4'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec_org_formatter
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.2.2
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.2.2
|
30
94
|
description: RSpec results meant to be viewed in an emacs org buffer
|
31
95
|
email: laynor@gmail.com
|
32
96
|
executables: []
|
33
97
|
extensions: []
|
34
98
|
extra_rdoc_files: []
|
35
99
|
files:
|
36
|
-
-
|
37
|
-
- lib/rspec/core/formatters/org_formatter.rb
|
38
|
-
- README.md
|
100
|
+
- .gitignore
|
39
101
|
- Gemfile
|
102
|
+
- Gemfile.lock
|
103
|
+
- README.md
|
104
|
+
- Rakefile
|
105
|
+
- lib/rspec/core/formatters/org_formatter.rb
|
106
|
+
- lib/rspec_org_formatter.rb
|
107
|
+
- rspec_org_formatter.gemspec
|
40
108
|
homepage: https://github.com/laynor/rspec_org_formatter
|
41
109
|
licenses: []
|
42
110
|
post_install_message:
|
@@ -49,12 +117,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
117
|
- - ! '>='
|
50
118
|
- !ruby/object:Gem::Version
|
51
119
|
version: '0'
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
hash: 4099472404938929791
|
52
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
124
|
none: false
|
54
125
|
requirements:
|
55
126
|
- - ! '>='
|
56
127
|
- !ruby/object:Gem::Version
|
57
128
|
version: '0'
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
hash: 4099472404938929791
|
58
132
|
requirements: []
|
59
133
|
rubyforge_project:
|
60
134
|
rubygems_version: 1.8.24
|
@@ -62,4 +136,3 @@ signing_key:
|
|
62
136
|
specification_version: 3
|
63
137
|
summary: RSpec Org Formatter
|
64
138
|
test_files: []
|
65
|
-
has_rdoc:
|