deem-test-fixture 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/test_fixture.rb +88 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 912ac8aa31f0026e5e60f50531c70feee56322054705bfc3d6e4efca7117fca4
|
4
|
+
data.tar.gz: 7b9224d3cc8232a253eca603eb83b6a6d93df13b67dd8eb0c54f625abe5d90c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4953f90a4188e98095c90a080b1f40752ca19cf4684bf7c39c614c3502c6551b801add8e9ad618e7e7f8d6acf027baf5bcbf675aadd8254aaefc28190cde6d66
|
7
|
+
data.tar.gz: b9475fe8f72bef46e2a2973bc600c8422971b62f039f1f0b5c69f463ca47c757a9633529e6dab24b3571ed349bece46969cf200f577209e88da866bc08b65a13
|
data/lib/test_fixture.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'json'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'minitest/hooks/test'
|
5
|
+
require 'minitest/reporters'
|
6
|
+
|
7
|
+
MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
|
8
|
+
|
9
|
+
module TestStatus
|
10
|
+
PASSED = :Passed
|
11
|
+
FAILED = :Failed
|
12
|
+
ERROR = :Error
|
13
|
+
end
|
14
|
+
|
15
|
+
class BaseTest < Minitest::Test
|
16
|
+
include Minitest::Hooks
|
17
|
+
|
18
|
+
def initialize(name)
|
19
|
+
super
|
20
|
+
@test_results = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def produce_test_result
|
24
|
+
status = if passed?
|
25
|
+
TestStatus::PASSED
|
26
|
+
elsif error?
|
27
|
+
TestStatus::ERROR
|
28
|
+
else
|
29
|
+
TestStatus::FAILED
|
30
|
+
end
|
31
|
+
{
|
32
|
+
'className' => class_name,
|
33
|
+
'methodName' => name,
|
34
|
+
'status' => status,
|
35
|
+
'timestamp' => DateTime.now.strftime('%Q'),
|
36
|
+
'score' => nil
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def teardown
|
41
|
+
super
|
42
|
+
@test_results << produce_test_result
|
43
|
+
end
|
44
|
+
|
45
|
+
def after_all
|
46
|
+
super
|
47
|
+
|
48
|
+
dir_name = '.test_results'
|
49
|
+
FileUtils.mkdir_p(dir_name) unless Dir.exist?(dir_name)
|
50
|
+
file_name = "0#{DateTime.now.strftime('%Q')}-deem-test-#{class_name}.json"
|
51
|
+
File.open(File.join(Dir.pwd, dir_name, file_name), 'w+') do |file|
|
52
|
+
file.write(@test_results.to_json)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module TestType
|
58
|
+
PUBLIC = :Public
|
59
|
+
FUNCTIONAL = :Functional
|
60
|
+
SIGNAL = :Signal
|
61
|
+
end
|
62
|
+
|
63
|
+
class ScoredBaseTest < BaseTest
|
64
|
+
|
65
|
+
def initialize(name)
|
66
|
+
super
|
67
|
+
@test_results = []
|
68
|
+
|
69
|
+
@test_type = TestType::PUBLIC
|
70
|
+
@test_weight = 0
|
71
|
+
@test_signal = nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def setup
|
75
|
+
@letter_board = LetterBoard.new
|
76
|
+
end
|
77
|
+
|
78
|
+
def produce_test_result
|
79
|
+
test_result = super
|
80
|
+
test_result['score'] = {
|
81
|
+
'testType' => @test_type,
|
82
|
+
'testWeight' => @test_weight,
|
83
|
+
'testSignal' => @test_signal
|
84
|
+
}
|
85
|
+
test_result
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deem-test-fixture
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Eliseyev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest-reporters
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest-hooks
|
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
|
+
description: Deem test fixture
|
42
|
+
email: alex@deem.ai
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/test_fixture.rb
|
48
|
+
homepage:
|
49
|
+
licenses: []
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Deem test fixture
|
70
|
+
test_files: []
|