petitest 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -0
- data/lib/petitest/configuration.rb +13 -8
- data/lib/petitest/subscriber_concerns/output_concern.rb +24 -0
- data/lib/petitest/{subscribers/timer_subscriber.rb → subscriber_concerns/time_concern.rb} +2 -3
- data/lib/petitest/subscribers/json_report_subscriber.rb +9 -4
- data/lib/petitest/subscribers/progress_report_subscriber.rb +12 -5
- data/lib/petitest/texts/base_text.rb +1 -1
- data/lib/petitest/version.rb +1 -1
- data/lib/petitest.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3397f79b2986d3d5d8923e80056e1b516297a70
|
4
|
+
data.tar.gz: 7fd4625071e8ec6ec1d160eaf919c74ff15b528a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d48d9522dd74bf68f64670363db7a4fdf9e0787e37702e37c14d2cc62e07f862f40ec8ca5818f7f1065e770afd7114f69f19041f9160eac3b84756bdb3f6d0
|
7
|
+
data.tar.gz: 0b3d803d927296fbc111446a2d9a74dccd0a24248b037cd567d66f10f6e80ce380bf98477caca696f563b6d5d8f4619eecc7c8176850b9c5de4ea35a8397daa3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,18 +9,23 @@ module Petitest
|
|
9
9
|
}
|
10
10
|
|
11
11
|
# @return [Hash{Symbol => Symbol}]
|
12
|
-
|
13
|
-
@color_scheme ||= DEFAULT_COLOR_SCHEME.dup
|
14
|
-
end
|
12
|
+
attr_accessor :color_scheme
|
15
13
|
|
16
14
|
# @return [Boolean]
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
attr_accessor :color
|
16
|
+
|
17
|
+
# @return [IO]
|
18
|
+
attr_accessor :output
|
20
19
|
|
21
20
|
# @return [Array<Petitest::Subscribers::BaseSubscriber>]
|
22
|
-
|
23
|
-
|
21
|
+
attr_accessor :subscribers
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@color_scheme = DEFAULT_COLOR_SCHEME.dup
|
25
|
+
@color = true
|
26
|
+
@output = ::STDOUT
|
27
|
+
@output.sync = true
|
28
|
+
@subscribers = [::Petitest::Subscribers::ProgressReportSubscriber.new]
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Petitest
|
2
|
+
module SubscriberConcerns
|
3
|
+
module OutputConcern
|
4
|
+
# @note Override
|
5
|
+
def after_running_test_cases(test_cases)
|
6
|
+
super
|
7
|
+
self.finished_at = ::Time.now
|
8
|
+
end
|
9
|
+
|
10
|
+
# @note Override
|
11
|
+
def before_running_test_cases(test_cases)
|
12
|
+
super
|
13
|
+
self.started_at = ::Time.now
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# @return [IO]
|
19
|
+
def output
|
20
|
+
::Petitest.configuration.output
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
require "petitest/subscribers/base_subscriber"
|
2
1
|
require "time"
|
3
2
|
|
4
3
|
module Petitest
|
5
|
-
module
|
6
|
-
|
4
|
+
module SubscriberConcerns
|
5
|
+
module TimeConcern
|
7
6
|
# @return [Time, nil]
|
8
7
|
attr_accessor :finished_at
|
9
8
|
|
@@ -1,9 +1,14 @@
|
|
1
1
|
require "json"
|
2
|
-
require "petitest/subscribers/
|
2
|
+
require "petitest/subscribers/base_subscriber"
|
3
|
+
require "petitest/subscriber_concerns/output_concern"
|
4
|
+
require "petitest/subscriber_concerns/time_concern"
|
3
5
|
|
4
6
|
module Petitest
|
5
7
|
module Subscribers
|
6
|
-
class JsonReportSubscriber < ::Petitest::Subscribers::
|
8
|
+
class JsonReportSubscriber < ::Petitest::Subscribers::BaseSubscriber
|
9
|
+
include ::Petitest::SubscriberConcerns::OutputConcern
|
10
|
+
include ::Petitest::SubscriberConcerns::TimeConcern
|
11
|
+
|
7
12
|
# @note Override
|
8
13
|
def after_running_test_cases(test_cases)
|
9
14
|
super
|
@@ -31,8 +36,8 @@ module Petitest
|
|
31
36
|
started_at: started_at.iso8601(6),
|
32
37
|
},
|
33
38
|
}
|
34
|
-
|
35
|
-
puts
|
39
|
+
string = ::JSON.pretty_generate(data)
|
40
|
+
output.puts(string)
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
@@ -1,22 +1,29 @@
|
|
1
|
-
require "petitest/subscribers/
|
1
|
+
require "petitest/subscribers/base_subscriber"
|
2
|
+
require "petitest/subscriber_concerns/output_concern"
|
3
|
+
require "petitest/subscriber_concerns/time_concern"
|
2
4
|
|
3
5
|
module Petitest
|
4
6
|
module Subscribers
|
5
|
-
class ProgressReportSubscriber < ::Petitest::Subscribers::
|
7
|
+
class ProgressReportSubscriber < ::Petitest::Subscribers::BaseSubscriber
|
8
|
+
include ::Petitest::SubscriberConcerns::OutputConcern
|
9
|
+
include ::Petitest::SubscriberConcerns::TimeConcern
|
10
|
+
|
6
11
|
# @note Override
|
7
12
|
def after_running_test_case(test_case)
|
8
13
|
super
|
9
|
-
|
14
|
+
string = ::Petitest::Texts::TestCaseResultCharacterText.new(test_case: test_case).to_s
|
15
|
+
output.print(string)
|
10
16
|
end
|
11
17
|
|
12
18
|
# @note Override
|
13
19
|
def after_running_test_cases(test_cases)
|
14
20
|
super
|
15
|
-
|
21
|
+
string = ::Petitest::Texts::TestCasesResultText.new(
|
16
22
|
finished_at: finished_at,
|
17
23
|
started_at: started_at,
|
18
24
|
test_cases: test_cases,
|
19
|
-
)
|
25
|
+
).to_s
|
26
|
+
output.puts(string)
|
20
27
|
end
|
21
28
|
end
|
22
29
|
end
|
data/lib/petitest/version.rb
CHANGED
data/lib/petitest.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require "petitest/assertion_failure_error"
|
2
2
|
require "petitest/assertions"
|
3
3
|
require "petitest/configuration"
|
4
|
+
require "petitest/subscriber_concerns/output_concern"
|
5
|
+
require "petitest/subscriber_concerns/time_concern"
|
4
6
|
require "petitest/subscribers/base_subscriber"
|
5
7
|
require "petitest/subscribers/json_report_subscriber"
|
6
8
|
require "petitest/subscribers/progress_report_subscriber"
|
7
|
-
require "petitest/subscribers/timer_subscriber"
|
8
9
|
require "petitest/test_case"
|
9
10
|
require "petitest/test_cases_runner"
|
10
11
|
require "petitest/test_group"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,10 +56,11 @@ files:
|
|
56
56
|
- lib/petitest/assertions.rb
|
57
57
|
- lib/petitest/autorun.rb
|
58
58
|
- lib/petitest/configuration.rb
|
59
|
+
- lib/petitest/subscriber_concerns/output_concern.rb
|
60
|
+
- lib/petitest/subscriber_concerns/time_concern.rb
|
59
61
|
- lib/petitest/subscribers/base_subscriber.rb
|
60
62
|
- lib/petitest/subscribers/json_report_subscriber.rb
|
61
63
|
- lib/petitest/subscribers/progress_report_subscriber.rb
|
62
|
-
- lib/petitest/subscribers/timer_subscriber.rb
|
63
64
|
- lib/petitest/test_case.rb
|
64
65
|
- lib/petitest/test_cases_runner.rb
|
65
66
|
- lib/petitest/test_group.rb
|