fried-test 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/fried-test.gemspec +1 -0
- data/lib/fried/test/activate.rb +20 -21
- data/lib/fried/test/autorun.rb +23 -24
- data/lib/fried/test/cli.rb +25 -26
- data/lib/fried/test/directory/current_working_directory.rb +28 -29
- data/lib/fried/test/directory/get_files_by_pattern.rb +31 -32
- data/lib/fried/test/get_test_directory.rb +30 -31
- data/lib/fried/test/get_test_files.rb +27 -28
- data/lib/fried/test/load_test_files.rb +26 -27
- data/lib/fried/test/load_tests_path.rb +29 -30
- data/lib/fried/test/noop.rb +4 -4
- data/lib/fried/test/prepend_to_load_path.rb +24 -24
- data/lib/fried/test/rake.rb +12 -5
- data/lib/fried/test/telemetry.rb +23 -22
- data/lib/fried/test/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df03bc52c07fa168110641d3a2182aef7ba01866
|
4
|
+
data.tar.gz: b01cf30cd17b4e6fa72807bf90f22276523472ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4966d2d615b78745c54d43c0a3b64a4d30ba612ed6f2a36c08d5710969534dc9079e9d9e801599d124c59e62ac9bae0f460ed43d55d4ab84ed55daaa61517dd
|
7
|
+
data.tar.gz: 6278b4bfa17d7119508eacd57a005878ff3079032b1fdb621910fdb2c954fb5c8197b0e6ec522ce9b8b029c3700f3da5b61796f7994626dff261a15ff379aa30
|
data/Rakefile
CHANGED
data/fried-test.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "rake"
|
29
29
|
spec.add_development_dependency "pry-byebug"
|
30
30
|
|
31
|
+
spec.add_runtime_dependency "fried-core"
|
31
32
|
spec.add_runtime_dependency "minitest"
|
32
33
|
spec.add_runtime_dependency "minitest-reporters"
|
33
34
|
end
|
data/lib/fried/test/activate.rb
CHANGED
@@ -1,33 +1,32 @@
|
|
1
1
|
require "minitest/spec"
|
2
|
+
require "fried/core"
|
2
3
|
|
3
|
-
module Fried
|
4
|
-
|
5
|
-
|
6
|
-
attr_accessor :target
|
4
|
+
module Fried::Test
|
5
|
+
class Activate
|
6
|
+
attr_accessor :target
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def initialize
|
9
|
+
@target = nil
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
12
|
+
def self.build
|
13
|
+
new.tap do |instance|
|
14
|
+
instance.target = Module
|
16
15
|
end
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
# @return [Void]
|
19
|
+
def call
|
20
|
+
return if target.nil?
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
22
|
+
target.class_eval do
|
23
|
+
include Minitest::Spec::DSL
|
25
24
|
end
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
27
|
+
def self.call
|
28
|
+
instance = build
|
29
|
+
instance.()
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
data/lib/fried/test/autorun.rb
CHANGED
@@ -1,38 +1,37 @@
|
|
1
|
+
require "fried/core"
|
1
2
|
require "fried/test/noop"
|
2
3
|
require "fried/test/telemetry"
|
3
4
|
|
4
|
-
module Fried
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
include ::Fried::Test::Telemetry
|
5
|
+
module Fried::Test
|
6
|
+
class Autorun
|
7
|
+
class Substitute
|
8
|
+
include ::Fried::Test::Telemetry
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
10
|
+
def call
|
11
|
+
record :call
|
12
|
+
nil
|
14
13
|
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
16
|
+
attr_accessor :execute
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def initialize
|
19
|
+
@execute = Noop
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
22
|
+
def self.build
|
23
|
+
new.tap do |instance|
|
24
|
+
instance.execute = method(:require)
|
26
25
|
end
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def call
|
29
|
+
execute.("minitest/autorun")
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
32
|
+
def self.call
|
33
|
+
instance = build
|
34
|
+
instance.()
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
data/lib/fried/test/cli.rb
CHANGED
@@ -1,38 +1,37 @@
|
|
1
|
+
require "fried/core"
|
1
2
|
require "fried/test/load_test_files"
|
2
3
|
require "fried/test/load_tests_path"
|
3
4
|
require "fried/test/autorun"
|
4
5
|
|
5
|
-
module Fried
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
attr_accessor :autorun
|
6
|
+
module Fried::Test
|
7
|
+
class CLI
|
8
|
+
attr_accessor :load_tests_path
|
9
|
+
attr_accessor :load_test_files
|
10
|
+
attr_accessor :autorun
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
def initialize
|
13
|
+
@load_tests_path = LoadTestsPath.new
|
14
|
+
@load_test_files = LoadTestFiles.new
|
15
|
+
@autorun = Autorun.new
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
18
|
+
def self.build
|
19
|
+
new.tap do |instance|
|
20
|
+
instance.load_tests_path = LoadTestsPath.build
|
21
|
+
instance.load_test_files = LoadTestFiles.build
|
22
|
+
instance.autorun = Autorun.build
|
24
23
|
end
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
def call
|
27
|
+
load_tests_path.()
|
28
|
+
load_test_files.()
|
29
|
+
autorun.()
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
32
|
+
def self.call
|
33
|
+
instance = build
|
34
|
+
instance.()
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
@@ -1,45 +1,44 @@
|
|
1
1
|
require "pathname"
|
2
|
+
require "fried/core"
|
2
3
|
|
3
|
-
module Fried
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
private
|
4
|
+
module Fried::Test
|
5
|
+
module Directory
|
6
|
+
class CurrentWorkingDirectory
|
7
|
+
class Substitute
|
8
|
+
private
|
9
9
|
|
10
|
-
|
10
|
+
attr_reader :path
|
11
11
|
|
12
|
-
|
12
|
+
public
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
def initialize(path = "/dev/null")
|
15
|
+
@path = path
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
18
|
+
def call
|
19
|
+
Pathname.new(path)
|
21
20
|
end
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
attr_accessor :dir
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
25
|
+
def self.build
|
26
|
+
new.tap do |instance|
|
27
|
+
instance.dir = Dir
|
29
28
|
end
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
# @return [Pathname]
|
32
|
+
def call
|
33
|
+
return Pathname.new("/dev/null") if dir.nil?
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
path_as_text = dir.pwd
|
36
|
+
Pathname.new(path_as_text)
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
39
|
+
def self.call
|
40
|
+
instance = build
|
41
|
+
instance.()
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
@@ -1,50 +1,49 @@
|
|
1
1
|
require "pathname"
|
2
|
+
require "fried/core"
|
2
3
|
require "fried/test/telemetry"
|
3
4
|
|
4
|
-
module Fried
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
class
|
9
|
-
|
10
|
-
include ::Fried::Test::Telemetry
|
5
|
+
module Fried::Test
|
6
|
+
module Directory
|
7
|
+
# Behaves like {Dir.glob}
|
8
|
+
class GetFilesByPattern
|
9
|
+
class Substitute
|
10
|
+
include ::Fried::Test::Telemetry
|
11
11
|
|
12
|
-
|
12
|
+
private
|
13
13
|
|
14
|
-
|
14
|
+
attr_reader :files
|
15
15
|
|
16
|
-
|
16
|
+
public
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def initialize(files = [])
|
19
|
+
@files = files
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
22
|
+
def call(pattern, flag = 0)
|
23
|
+
record :call, [pattern, flag]
|
24
|
+
files.map(&:to_s)
|
26
25
|
end
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
attr_accessor :dir
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
30
|
+
def self.build
|
31
|
+
new.tap do |instance|
|
32
|
+
instance.dir = Dir
|
34
33
|
end
|
34
|
+
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# @see Dir.glob
|
37
|
+
# @return [Array<String>]
|
38
|
+
def call(pattern, flags = 0)
|
39
|
+
return [] if dir.nil?
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
dir.glob(pattern, flags)
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
44
|
+
def self.call
|
45
|
+
instance = build
|
46
|
+
instance.()
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
@@ -1,49 +1,48 @@
|
|
1
|
+
require "fried/core"
|
1
2
|
require "pathname"
|
2
3
|
require "fried/test/directory/current_working_directory"
|
3
4
|
|
4
|
-
module Fried
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
private
|
5
|
+
module Fried::Test
|
6
|
+
class GetTestDirectory
|
7
|
+
class Substitute
|
8
|
+
private
|
9
9
|
|
10
|
-
|
10
|
+
attr_reader :test_path
|
11
11
|
|
12
|
-
|
12
|
+
public
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
def initialize(test_path)
|
15
|
+
@test_path = test_path
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
18
|
+
def call
|
19
|
+
Pathname.new(test_path)
|
21
20
|
end
|
21
|
+
end
|
22
22
|
|
23
|
-
|
23
|
+
attr_accessor :current_working_directory
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def initialize
|
26
|
+
@current_working_directory = Directory::CurrentWorkingDirectory.new
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def self.build
|
30
|
+
new.tap do |instance|
|
31
|
+
cwd = Directory::CurrentWorkingDirectory.build
|
32
32
|
|
33
|
-
|
34
|
-
end
|
33
|
+
instance.current_working_directory = cwd
|
35
34
|
end
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
# @return [Pathname]
|
38
|
+
def call
|
39
|
+
path = current_working_directory.()
|
40
|
+
path.join("./test")
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
43
|
+
def self.call
|
44
|
+
instance = build
|
45
|
+
instance.()
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -1,42 +1,41 @@
|
|
1
1
|
require "pathname"
|
2
|
+
require "fried/core"
|
2
3
|
require "fried/test/directory/get_files_by_pattern"
|
3
4
|
require "fried/test/get_test_directory"
|
4
5
|
|
5
|
-
module Fried
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
GlobPattern = Pathname.new("./**/*_test.rb").freeze
|
6
|
+
module Fried::Test
|
7
|
+
# Get absolute path to all test files for current working directory
|
8
|
+
class GetTestFiles
|
9
|
+
GlobPattern = Pathname.new("./**/*_test.rb").freeze
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
attr_accessor :get_files_by_pattern
|
12
|
+
attr_accessor :get_test_directory
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def initialize
|
15
|
+
@get_files_by_pattern = Directory::GetFilesByPattern.new
|
16
|
+
@get_test_directory = GetTestDirectory.new
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
19
|
+
def self.build
|
20
|
+
new.tap do |instance|
|
21
|
+
instance.get_files_by_pattern = Directory::GetFilesByPattern.build
|
22
|
+
instance.get_test_directory = GetTestDirectory.build
|
24
23
|
end
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# @return [Enumerator<Pathname>]
|
27
|
+
def call
|
28
|
+
directory = get_test_directory.()
|
29
|
+
pattern = directory.join(GlobPattern)
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
files = get_files_by_pattern.(pattern.to_s)
|
32
|
+
files.map! { |file| directory.join(file) }
|
33
|
+
files.each
|
34
|
+
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
36
|
+
def self.call
|
37
|
+
instance = build
|
38
|
+
instance.()
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
@@ -1,40 +1,39 @@
|
|
1
|
+
require "fried/core"
|
1
2
|
require "fried/test/get_test_files"
|
2
3
|
|
3
|
-
module Fried
|
4
|
-
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
include ::Fried::Test::Telemetry
|
4
|
+
module Fried::Test
|
5
|
+
# Load test files using {require_relative}
|
6
|
+
class LoadTestFiles
|
7
|
+
class Substitute
|
8
|
+
include ::Fried::Test::Telemetry
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
10
|
+
def call
|
11
|
+
record :call
|
12
|
+
nil
|
14
13
|
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
16
|
+
attr_accessor :get_test_files
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def initialize
|
19
|
+
@get_test_files = GetTestFiles.new
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
22
|
+
def self.build
|
23
|
+
new.tap do |instance|
|
24
|
+
instance.get_test_files = GetTestFiles.build
|
26
25
|
end
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
# @return [Void]
|
29
|
+
def call
|
30
|
+
test_files = get_test_files.()
|
31
|
+
test_files.each { |file| require_relative file.to_s }
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
34
|
+
def self.call
|
35
|
+
instance = build
|
36
|
+
instance.()
|
38
37
|
end
|
39
38
|
end
|
40
39
|
end
|
@@ -1,44 +1,43 @@
|
|
1
|
+
require "fried/core"
|
1
2
|
require "fried/test/get_test_directory"
|
2
3
|
require "fried/test/prepend_to_load_path"
|
3
4
|
|
4
|
-
module Fried
|
5
|
-
|
6
|
-
|
7
|
-
class
|
8
|
-
|
9
|
-
include ::Fried::Test::Telemetry
|
5
|
+
module Fried::Test
|
6
|
+
# Puts tests path into {$LOAD_PATH}
|
7
|
+
class LoadTestsPath
|
8
|
+
class Substitute
|
9
|
+
include ::Fried::Test::Telemetry
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
def call
|
12
|
+
record :call
|
13
|
+
nil
|
15
14
|
end
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
attr_accessor :get_test_directory
|
18
|
+
attr_accessor :prepend_to_load_path
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def initialize
|
21
|
+
@get_test_directory = GetTestDirectory.new
|
22
|
+
@prepend_to_load_path = PrependToLoadPath.new
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
25
|
+
def self.build
|
26
|
+
new.tap do |instance|
|
27
|
+
instance.get_test_directory = GetTestDirectory.build
|
28
|
+
instance.prepend_to_load_path = PrependToLoadPath.build
|
30
29
|
end
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
# @param [Void]
|
33
|
+
def call
|
34
|
+
lib = get_test_directory.()
|
35
|
+
prepend_to_load_path.(lib)
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
38
|
+
def self.call
|
39
|
+
instance = build
|
40
|
+
instance.()
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
data/lib/fried/test/noop.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require "fried/core"
|
2
|
+
|
3
|
+
module Fried::Test
|
4
|
+
Noop = ->(*,**) {}.freeze
|
5
5
|
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
|
2
|
-
module Test
|
3
|
-
# Unshifts the path to {$LOAD_PATH} unless already existing
|
4
|
-
class PrependToLoadPath
|
5
|
-
attr_accessor :load_path
|
1
|
+
require "fried/core"
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module Fried::Test
|
4
|
+
# Unshifts the path to {$LOAD_PATH} unless already existing
|
5
|
+
class PrependToLoadPath
|
6
|
+
attr_accessor :load_path
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@load_path = []
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
12
|
+
def self.build
|
13
|
+
new.tap do |instance|
|
14
|
+
instance.load_path = $LOAD_PATH
|
15
15
|
end
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
# @param path [String, Pathname]
|
19
|
+
# @return [Boolean] {true} if path was added, {false} if already present
|
20
|
+
def call(path)
|
21
|
+
text_path = path.to_s
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
has_path = load_path.include?(text_path)
|
24
|
+
load_path.unshift(text_path) unless has_path
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
!has_path
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
29
|
+
def self.call
|
30
|
+
instance = build
|
31
|
+
instance.()
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/fried/test/rake.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
require "rake"
|
2
|
+
require "fried/core"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
module Fried::Test
|
5
|
+
module Rake
|
6
|
+
extend ::Rake::DSL
|
6
7
|
|
7
|
-
|
8
|
+
task :test do
|
9
|
+
lib = File.expand_path("../../../", __FILE__)
|
10
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
8
11
|
|
9
|
-
|
12
|
+
require "fried/test"
|
13
|
+
|
14
|
+
Fried::Test::CLI.()
|
15
|
+
end
|
16
|
+
end
|
10
17
|
end
|
data/lib/fried/test/telemetry.rb
CHANGED
@@ -1,31 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Telemetry
|
4
|
-
Record = Struct.new(:signal, :time, :data)
|
1
|
+
require "time"
|
2
|
+
require "fried/core"
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
module Fried::Test
|
5
|
+
module Telemetry
|
6
|
+
Record = Struct.new(:signal, :time, :data)
|
7
|
+
|
8
|
+
def record(signal, data = nil)
|
9
|
+
@__telemetry_records__ ||= []
|
10
|
+
time = Time.now.utc
|
11
|
+
@__telemetry_records__ << Record.new(signal, time, data)
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
14
|
+
def recorded?(signal)
|
15
|
+
@__telemetry_records__.any? do |recorded|
|
16
|
+
recorded.signal == signal
|
16
17
|
end
|
18
|
+
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
20
|
+
def recorded_with?(signal, data)
|
21
|
+
@__telemetry_records__.any? do |recorded|
|
22
|
+
recorded.signal == signal &&
|
23
|
+
recorded.data == data
|
23
24
|
end
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
27
|
+
def recorded_times?(signal, amount)
|
28
|
+
@__telemetry_records__.count do |recorded|
|
29
|
+
recorded.signal == signal
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/fried/test/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fried-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fire-Dragon-DoL
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fried-core
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|