ci_logger 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/ci_logger/minitest/integration.rb +19 -0
- data/lib/ci_logger/railtie.rb +11 -21
- data/lib/ci_logger/rspec/example_group_methods.rb +16 -0
- data/lib/ci_logger/rspec/integration.rb +22 -0
- data/lib/ci_logger/version.rb +1 -1
- metadata +6 -18
- data/lib/ci_logger/example_group_methods.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ea3c804f1e3d3355f06ef8a71931c4c87f27e28b9e851505454ce0e3889e1b3
|
4
|
+
data.tar.gz: 9243562646418cd0f1849c6d1e65c93832380641640bd92b0aa4ec3a4aed7cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 374b4100e406ac38d424dcebcbbe8c8d5759ca224a71a5025cade5de9d59b7e62f0d288547f3f2264f2c286d1a617c17e9f34de9ddb508d3fb1532b4fbe63e08
|
7
|
+
data.tar.gz: 741390996e587d384281854f135b5a0c5532cd633e66138f2ae578bb407d56985066d06f8766648159e587c722489452e5d2c1dff85d54f2b76f5d8ec2bb4acc
|
data/README.md
CHANGED
@@ -6,11 +6,9 @@ CiLogger specifically generates logs for failed tests, which proves invaluable d
|
|
6
6
|
|
7
7
|
## prerequisite
|
8
8
|
|
9
|
-
- rspec
|
9
|
+
- rspec or minitest
|
10
10
|
- rails(>= 6.0)
|
11
11
|
|
12
|
-
If you want minitest integration, send Pull Request!
|
13
|
-
|
14
12
|
## Installation
|
15
13
|
|
16
14
|
Add this line to your application's Gemfile:
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CiLogger
|
2
|
+
module Minitest
|
3
|
+
module Integration
|
4
|
+
def before_teardown
|
5
|
+
super
|
6
|
+
if !Rails.application.config.ci_logger.enabled
|
7
|
+
Rails.logger.sync
|
8
|
+
elsif passed? || skipped?
|
9
|
+
Rails.logger.clear
|
10
|
+
else
|
11
|
+
Rails.logger.sync
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
class ActiveSupport::TestCase
|
18
|
+
include CiLogger::Minitest::Integration
|
19
|
+
end
|
data/lib/ci_logger/railtie.rb
CHANGED
@@ -6,28 +6,18 @@ module CiLogger
|
|
6
6
|
config.before_initialize do
|
7
7
|
if Rails.application.config.ci_logger.enabled
|
8
8
|
Rails.logger = CiLogger::Logger.new(Rails.logger)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
config.prepend_before do |example|
|
16
|
-
next unless Rails.application.config.ci_logger.enabled
|
17
|
-
|
18
|
-
Rails.logger.debug("start example at #{example.location}")
|
19
|
-
end
|
9
|
+
begin
|
10
|
+
require "rspec/core"
|
11
|
+
require "ci_logger/rspec/integration"
|
12
|
+
rescue LoadError
|
13
|
+
# do nothing
|
14
|
+
end
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
else
|
27
|
-
Rails.logger.debug("finish example at #{example.location}")
|
28
|
-
Rails.logger.sync
|
29
|
-
end
|
30
|
-
end
|
16
|
+
begin
|
17
|
+
require "active_support/test_case"
|
18
|
+
require "ci_logger/minitest/integration"
|
19
|
+
rescue LoadError
|
20
|
+
# do nothing
|
31
21
|
end
|
32
22
|
end
|
33
23
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module CiLogger
|
2
|
+
module Rspec
|
3
|
+
module ExampleGroupMethods
|
4
|
+
# original from https://github.com/rspec/rspec-rails/blob/229f5f7ca9c0de0c7bca452450416d988f7cf612/lib/rspec/rails/example/system_example_group.rb#L28-L37
|
5
|
+
def passed?
|
6
|
+
return false if RSpec.current_example.exception
|
7
|
+
return true unless defined?(::RSpec::Expectations::FailureAggregator)
|
8
|
+
|
9
|
+
failure_notifier = ::RSpec::Support.failure_notifier
|
10
|
+
return true unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)
|
11
|
+
|
12
|
+
failure_notifier.failures.empty? && failure_notifier.other_errors.empty?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "ci_logger/rspec/example_group_methods"
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.include CiLogger::Rspec::ExampleGroupMethods
|
5
|
+
|
6
|
+
config.prepend_before do |example|
|
7
|
+
next unless Rails.application.config.ci_logger.enabled
|
8
|
+
|
9
|
+
Rails.logger.debug("start example at #{example.location}")
|
10
|
+
end
|
11
|
+
|
12
|
+
config.append_after do |example|
|
13
|
+
if !Rails.application.config.ci_logger.enabled
|
14
|
+
Rails.logger.sync
|
15
|
+
elsif passed?
|
16
|
+
Rails.logger.clear
|
17
|
+
else
|
18
|
+
Rails.logger.debug("finish example at #{example.location}")
|
19
|
+
Rails.logger.sync
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/ci_logger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 6.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec-core
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec-rails
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,9 +49,11 @@ files:
|
|
63
49
|
- README.md
|
64
50
|
- Rakefile
|
65
51
|
- lib/ci_logger.rb
|
66
|
-
- lib/ci_logger/example_group_methods.rb
|
67
52
|
- lib/ci_logger/logger.rb
|
53
|
+
- lib/ci_logger/minitest/integration.rb
|
68
54
|
- lib/ci_logger/railtie.rb
|
55
|
+
- lib/ci_logger/rspec/example_group_methods.rb
|
56
|
+
- lib/ci_logger/rspec/integration.rb
|
69
57
|
- lib/ci_logger/version.rb
|
70
58
|
- lib/tasks/ci_logger_tasks.rake
|
71
59
|
homepage: https://github.com/willnet/ci_logger
|
@@ -90,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
78
|
- !ruby/object:Gem::Version
|
91
79
|
version: '0'
|
92
80
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
81
|
+
rubygems_version: 3.4.17
|
94
82
|
signing_key:
|
95
83
|
specification_version: 4
|
96
84
|
summary: Faster logger for CI
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module CiLogger
|
2
|
-
module ExampleGroupMethods
|
3
|
-
# original from https://github.com/rspec/rspec-rails/blob/229f5f7ca9c0de0c7bca452450416d988f7cf612/lib/rspec/rails/example/system_example_group.rb#L28-L37
|
4
|
-
def passed?
|
5
|
-
return false if RSpec.current_example.exception
|
6
|
-
return true unless defined?(::RSpec::Expectations::FailureAggregator)
|
7
|
-
|
8
|
-
failure_notifier = ::RSpec::Support.failure_notifier
|
9
|
-
return true unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)
|
10
|
-
|
11
|
-
failure_notifier.failures.empty? && failure_notifier.other_errors.empty?
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|