rspec-summary-log 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/lib/rspec/summary_log.rb +7 -0
- data/lib/rspec/summary_log/base_logger.rb +61 -0
- data/lib/rspec/summary_log/failed_logger.rb +34 -0
- data/lib/rspec/summary_log/summary_logger.rb +31 -0
- data/lib/rspec/summary_log/version.rb +10 -0
- data/rspec-summary-log.gemspec +22 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2a40cf8b624fb9843903d6c37b9814f38763489c
|
4
|
+
data.tar.gz: b7757d3f39828b3d1a2db2b7da660608978f9173
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98a1e9a4a091e80e6cd470a56b1b16147b994ebb47d278bd267f23b14c2f163ea637fa55b4fc99c8d548da677583771c3079f76e317542b2c941c21cc396ff19
|
7
|
+
data.tar.gz: 9ea8865fcace701a60d0791094a33a0f2ee5aa53911b78a5c77f30ecd0f4b48893c6b24379368cd923665a36ecc3595e38dcbdd9e5cd47204fa6e340281a010d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# rspec-summary-log
|
2
|
+
[](https://rubygems.org/gems/rspec-summary-log)
|
3
|
+
|
4
|
+
If you use gems like [parallel_tests](https://github.com/grosser/parallel_tests) you may need a full log of failed tests for ci.
|
5
|
+
|
6
|
+
Install
|
7
|
+
=======
|
8
|
+
```
|
9
|
+
gem install rspec-summary-log
|
10
|
+
|
11
|
+
# spec/spec_helper.rb
|
12
|
+
require 'rspec/summary_log'
|
13
|
+
|
14
|
+
# .rspec (or .rspec_parallel)
|
15
|
+
--require rails_helper
|
16
|
+
--format progress
|
17
|
+
--format RSpec::SummaryLog::FailedLogger --out tmp/failed.log
|
18
|
+
--format RSpec::SummaryLog::SummaryLogger --out tmp/summary.log
|
19
|
+
```
|
20
|
+
|
21
|
+
Loggers
|
22
|
+
=======
|
23
|
+
We have two kind of loggers:
|
24
|
+
|
25
|
+
#### RSpec::SummaryLog::FailedLogger
|
26
|
+
|
27
|
+
This logger writes file names of broken specs.
|
28
|
+
|
29
|
+
```
|
30
|
+
# tmp/failed.log
|
31
|
+
|
32
|
+
./spec/specifications/order_specification_spec.rb:14
|
33
|
+
./spec/specifications/order_specification_spec.rb:20
|
34
|
+
./spec/specifications/cart_specification_spec.rb:32
|
35
|
+
./spec/specifications/user_specification_spec.rb:67
|
36
|
+
./spec/specifications/admin_specification_spec.rb:73
|
37
|
+
```
|
38
|
+
|
39
|
+
For example you can rerun failed tests with `rspec $(cat tmp/failed.log)`.
|
40
|
+
|
41
|
+
#### RSpec::SummaryLog::SummaryLogger
|
42
|
+
|
43
|
+
This logger writes summary of broken specs.
|
44
|
+
|
45
|
+
```
|
46
|
+
# tmp/summary.log
|
47
|
+
|
48
|
+
1) OrderSpecification#satisfied? should allow to order product
|
49
|
+
Failure/Error: let(:product) { create(:product, row_type: row_type, rows_count: rows_count) }
|
50
|
+
NoMethodError:
|
51
|
+
undefined method `id' for nil:NilClass
|
52
|
+
# ./spec/support/factories/user.rb:3:in `block (3 levels) in <top (required)>'
|
53
|
+
# ./spec/support/factories/user.rb:3:in `block (3 levels) in <top (required)>'
|
54
|
+
# /home/llxff/.rvm/gems/ruby-2.3.0@project/gems/factory_girl-4.5.0/lib/factory_girl/attribute/dynamic.rb:14:in `instance_exec'
|
55
|
+
# /home/llxff/.rvm/gems/ruby-2.3.0@project/gems/factory_girl-4.5.0/lib/factory_girl/attribute/dynamic.rb:14:in `block in to_proc'
|
56
|
+
|
57
|
+
rspec ./spec/specifications/order_specification_spec.rb:14
|
58
|
+
|
59
|
+
2) OrderSpecification#satisfied? should not allow to order product
|
60
|
+
Failure/Error: let(:product) { create(:product, row_type: row_type, rows_count: rows_count) }
|
61
|
+
NoMethodError:
|
62
|
+
undefined method `id' for nil:NilClass
|
63
|
+
# ./spec/support/factories/user.rb:3:in `block (3 levels) in <top (required)>'
|
64
|
+
# /home/llxff/.rvm/gems/ruby-2.3.0@project/gems/factory_girl-4.5.0/lib/factory_girl/attribute/dynamic.rb:14:in `instance_exec'
|
65
|
+
# /home/llxff/.rvm/gems/ruby-2.3.0@project/gems/factory_girl-4.5.0/lib/factory_girl/attribute/dynamic.rb:14:in `block in to_proc'
|
66
|
+
# /home/llxff/.rvm/gems/ruby-2.3.0@project/gems/factory_girl-4.5.0/lib/factory_girl/evaluator.rb:71:in `instance_exec'
|
67
|
+
|
68
|
+
rspec ./spec/specifications/order_specification_spec.rb:20
|
69
|
+
```
|
70
|
+
|
71
|
+
Authors
|
72
|
+
=======
|
73
|
+
|
74
|
+
- [Aleksandr Fomin](http://github.com/llxff)
|
75
|
+
- [Kamila Sharipova](https://github.com/kamsharipova)
|
76
|
+
- [Nikolay Sverchkov](https://github.com/ssnikolay)
|
77
|
+
|
78
|
+
**License: MIT**
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#stolen from ParallelTests
|
2
|
+
module RSpec
|
3
|
+
module SummaryLog
|
4
|
+
begin
|
5
|
+
require 'rspec/core/formatters/base_text_formatter'
|
6
|
+
BaseLogger = Class.new(RSpec::Core::Formatters::BaseTextFormatter)
|
7
|
+
rescue LoadError
|
8
|
+
require 'spec/runner/formatter/base_text_formatter'
|
9
|
+
BaseLogger = Class.new(Spec::Runner::Formatter::BaseTextFormatter)
|
10
|
+
end
|
11
|
+
|
12
|
+
class BaseLogger
|
13
|
+
def initialize(*args)
|
14
|
+
super
|
15
|
+
|
16
|
+
@output ||= args[1] || args[0] # rspec 1 has output as second argument
|
17
|
+
|
18
|
+
if String === @output # a path ?
|
19
|
+
FileUtils.mkdir_p(File.dirname(@output))
|
20
|
+
File.open(@output, 'w'){} # overwrite previous results
|
21
|
+
@output = File.open(@output, 'a')
|
22
|
+
elsif File === @output # close and restart in append mode
|
23
|
+
@output.close
|
24
|
+
@output = File.open(@output.path, 'a')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
#stolen from Rspec
|
29
|
+
def close(*args)
|
30
|
+
@output.close if (IO === @output) & (@output != $stdout)
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
# do not let multiple processes get in each others way
|
36
|
+
def lock_output
|
37
|
+
if File === @output
|
38
|
+
begin
|
39
|
+
@output.flock File::LOCK_EX
|
40
|
+
yield
|
41
|
+
ensure
|
42
|
+
@output.flock File::LOCK_UN
|
43
|
+
end
|
44
|
+
else
|
45
|
+
yield
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# From Rspec v3.3 rerun_argument becomes to be deprecated
|
50
|
+
def example_rerun_argument(example)
|
51
|
+
if example.respond_to?(:location_rerun_argument)
|
52
|
+
example.location_rerun_argument
|
53
|
+
elsif example.respond_to?(:rerun_argument)
|
54
|
+
example.rerun_argument
|
55
|
+
else
|
56
|
+
example.location
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RSpec
|
2
|
+
module SummaryLog
|
3
|
+
class FailedLogger < BaseLogger
|
4
|
+
RSpec::Core::Formatters.register self, :dump_summary
|
5
|
+
|
6
|
+
def start(*)
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def dump_failures(*)
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def dump_summary(*args)
|
15
|
+
lock_output do
|
16
|
+
notification = args.first
|
17
|
+
|
18
|
+
notification.failed_examples.each do |ex|
|
19
|
+
output.puts(example_rerun_argument(ex))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
@output.flush
|
23
|
+
end
|
24
|
+
|
25
|
+
def dump_pending(*)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def seed(notification)
|
30
|
+
true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RSpec
|
2
|
+
module SummaryLog
|
3
|
+
class SummaryLogger < BaseLogger
|
4
|
+
RSpec::Core::Formatters.register self, :dump_summary
|
5
|
+
|
6
|
+
def start(*)
|
7
|
+
true
|
8
|
+
end
|
9
|
+
|
10
|
+
def dump_summary(*args)
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def dump_failures(notification)
|
15
|
+
return if notification.failure_notifications.empty?
|
16
|
+
|
17
|
+
lock_output do
|
18
|
+
notification.failure_notifications.each_with_index do |failure, index|
|
19
|
+
output.puts failure.fully_formatted(index.next, ::RSpec::Core::Formatters::ConsoleCodes)
|
20
|
+
output.puts $/ + 'rspec ' + example_rerun_argument(failure.example)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
@output.flush
|
24
|
+
end
|
25
|
+
|
26
|
+
def dump_pending(*)
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require_relative 'lib/rspec/summary_log/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'rspec-summary-log'
|
6
|
+
s.version = RSpec::SummaryLog::Version::STRING
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['Aleksandr Fomin', 'Kamila Sharipova', 'Nikolay Sverchkov']
|
9
|
+
s.email = ['ll.wg.bin@gmail.com', 'kam.sharipova@gmail.com', 'ssnikolay@gmail.com']
|
10
|
+
s.homepage = 'https://github.com/RuntimeLLC/rspec-summary-log'
|
11
|
+
s.summary = 'Log summary of failed tests for CI'
|
12
|
+
s.description = s.summary
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split($/).map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
s.license = 'MIT'
|
19
|
+
s.add_dependency 'rspec', '~> 3'
|
20
|
+
|
21
|
+
s.add_development_dependency 'rake'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-summary-log
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aleksandr Fomin
|
8
|
+
- Kamila Sharipova
|
9
|
+
- Nikolay Sverchkov
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '3'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
description: Log summary of failed tests for CI
|
44
|
+
email:
|
45
|
+
- ll.wg.bin@gmail.com
|
46
|
+
- kam.sharipova@gmail.com
|
47
|
+
- ssnikolay@gmail.com
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- ".gitignore"
|
53
|
+
- Gemfile
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- lib/rspec/summary_log.rb
|
58
|
+
- lib/rspec/summary_log/base_logger.rb
|
59
|
+
- lib/rspec/summary_log/failed_logger.rb
|
60
|
+
- lib/rspec/summary_log/summary_logger.rb
|
61
|
+
- lib/rspec/summary_log/version.rb
|
62
|
+
- rspec-summary-log.gemspec
|
63
|
+
homepage: https://github.com/RuntimeLLC/rspec-summary-log
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.4.8
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Log summary of failed tests for CI
|
87
|
+
test_files: []
|