fried-test 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +91 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/friest +9 -0
- data/fried-test.gemspec +29 -0
- data/lib/fried/test/activate.rb +33 -0
- data/lib/fried/test/autorun.rb +38 -0
- data/lib/fried/test/cli.rb +38 -0
- data/lib/fried/test/directory/current_working_directory.rb +46 -0
- data/lib/fried/test/directory/get_files_by_pattern.rb +51 -0
- data/lib/fried/test/get_test_directory.rb +49 -0
- data/lib/fried/test/get_test_files.rb +42 -0
- data/lib/fried/test/load_test_files.rb +40 -0
- data/lib/fried/test/load_tests_path.rb +44 -0
- data/lib/fried/test/noop.rb +5 -0
- data/lib/fried/test/prepend_to_load_path.rb +34 -0
- data/lib/fried/test/telemetry.rb +32 -0
- data/lib/fried/test/version.rb +5 -0
- data/lib/fried/test.rb +13 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 92d60aed6837d1a83e7c87143d1a33ca1b213059
|
4
|
+
data.tar.gz: c8669b44945b0c231a3074457aa392db9d10ff96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9934df539343c2882c55e410ca461eacf23b06ad9a9e86c40a69230422814ce7f0e8d69893ef85f213a65818d0f301fa84cf1f14115af293940f42062d39847d
|
7
|
+
data.tar.gz: 0a24a5e78899936cf3d8d17e684cfee16ef1276aaf6378aace415555c9624cf9c1d8875bc642b160119c66bc0b59f526d411fc4d0d848386dfb5105fbb49abde
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Francesco Belladonna
|
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,91 @@
|
|
1
|
+
# Fried::Test [![Build Status][test-badge]][test-link]
|
2
|
+
|
3
|
+
This gem provides a small executable named `friest` which is just an
|
4
|
+
opinionated wrapper around `minitest/autorun`. You can run `friest` and it
|
5
|
+
will run the test suite automatically for any test found in the directory
|
6
|
+
`test` with any file ending with `_test.rb`.
|
7
|
+
|
8
|
+
## Philosophy
|
9
|
+
|
10
|
+
This gem is mainly a **philosophy** on how your tests should be written.
|
11
|
+
Tests API should be so simple that any Ruby developer can jump in and use it.
|
12
|
+
|
13
|
+
Here is how your tests should look:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require "test_helper"
|
17
|
+
|
18
|
+
class HelloWorldTest < Minitest::Spec
|
19
|
+
def setup
|
20
|
+
@text = "hello, world!"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "uses text 'hello, world!'" do
|
24
|
+
assert "hello, world!" == @text
|
25
|
+
end
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
This is pure ruby. We don't use `def` because it feels more magical having
|
30
|
+
to prefix methods with `test_`, so `it` might as well do it. In addition,
|
31
|
+
pure text is much more descriptive than a method with_underscores_in_name.
|
32
|
+
|
33
|
+
You are allowed to use only the following assertions:
|
34
|
+
|
35
|
+
- `assert`
|
36
|
+
- `refute`
|
37
|
+
- `assert_raises`
|
38
|
+
|
39
|
+
So that any junior can join your team and write tests immediately.
|
40
|
+
You are not allowed to use `describe` (it creates nested classes).
|
41
|
+
|
42
|
+
If you have to share tests between classes, use:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
module MySharedTest
|
46
|
+
it "has value equal to 0" do
|
47
|
+
assert @value == 0
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
and just `include MySharedTest` where needed.
|
53
|
+
|
54
|
+
## Installation
|
55
|
+
|
56
|
+
Add this line to your application's Gemfile:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
gem 'fried-test'
|
60
|
+
```
|
61
|
+
|
62
|
+
And then execute:
|
63
|
+
|
64
|
+
$ bundle
|
65
|
+
|
66
|
+
Or install it yourself as:
|
67
|
+
|
68
|
+
$ gem install fried-test
|
69
|
+
|
70
|
+
Then require **and activate** the gem in your `test_helper.rb`
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
require "fried-test"
|
74
|
+
Fried::Test.activate
|
75
|
+
```
|
76
|
+
|
77
|
+
The "activation" is optional, it monkey patches `Module` class so that you can
|
78
|
+
use module to share tests.
|
79
|
+
|
80
|
+
## Development
|
81
|
+
|
82
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
83
|
+
|
84
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
|
88
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Fire-Dragon-DoL/fried-test.
|
89
|
+
|
90
|
+
[test-badge]: https://travis-ci.org/Fire-Dragon-DoL/fried-test.svg?branch=master
|
91
|
+
[test-link]: https://travis-ci.org/Fire-Dragon-DoL/fried-test
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fried/test"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/friest
ADDED
data/fried-test.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "fried/test/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fried-test"
|
8
|
+
spec.version = Fried::Test::VERSION
|
9
|
+
spec.authors = ["Fire-Dragon-DoL"]
|
10
|
+
spec.email = ["francesco.belladonna@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Minitest helpers and testing philosophy}
|
13
|
+
spec.description = %q{Minitest helpers and testing philosophy}
|
14
|
+
spec.homepage = "https://github.com/Fire-Dragon-DoL/fried-test"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "pry-byebug"
|
26
|
+
|
27
|
+
spec.add_runtime_dependency "minitest"
|
28
|
+
spec.add_runtime_dependency "minitest-reporters"
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "minitest/spec"
|
2
|
+
|
3
|
+
module Fried
|
4
|
+
module Test
|
5
|
+
class Activate
|
6
|
+
attr_accessor :target
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@target = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.build
|
13
|
+
new.tap do |instance|
|
14
|
+
instance.target = Module
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Void]
|
19
|
+
def call
|
20
|
+
return if target.nil?
|
21
|
+
|
22
|
+
target.class_eval do
|
23
|
+
include Minitest::Spec::DSL
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.call
|
28
|
+
instance = build
|
29
|
+
instance.()
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "fried/test/noop"
|
2
|
+
require "fried/test/telemetry"
|
3
|
+
|
4
|
+
module Fried
|
5
|
+
module Test
|
6
|
+
class Autorun
|
7
|
+
class Substitute
|
8
|
+
include ::Fried::Test::Telemetry
|
9
|
+
|
10
|
+
def call
|
11
|
+
record :call
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :execute
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@execute = Noop
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build
|
23
|
+
new.tap do |instance|
|
24
|
+
instance.execute = method(:require)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def call
|
29
|
+
execute.("minitest/autorun")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.call
|
33
|
+
instance = build
|
34
|
+
instance.()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "fried/test/load_test_files"
|
2
|
+
require "fried/test/load_tests_path"
|
3
|
+
require "fried/test/autorun"
|
4
|
+
|
5
|
+
module Fried
|
6
|
+
module Test
|
7
|
+
class CLI
|
8
|
+
attr_accessor :load_tests_path
|
9
|
+
attr_accessor :load_test_files
|
10
|
+
attr_accessor :autorun
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@load_tests_path = LoadTestsPath.new
|
14
|
+
@load_test_files = LoadTestFiles.new
|
15
|
+
@autorun = Autorun.new
|
16
|
+
end
|
17
|
+
|
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
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def call
|
27
|
+
load_tests_path.()
|
28
|
+
load_test_files.()
|
29
|
+
autorun.()
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.call
|
33
|
+
instance = build
|
34
|
+
instance.()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
module Fried
|
4
|
+
module Test
|
5
|
+
module Directory
|
6
|
+
class CurrentWorkingDirectory
|
7
|
+
class Substitute
|
8
|
+
private
|
9
|
+
|
10
|
+
attr_reader :path
|
11
|
+
|
12
|
+
public
|
13
|
+
|
14
|
+
def initialize(path = "/dev/null")
|
15
|
+
@path = path
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
Pathname.new(path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_accessor :dir
|
24
|
+
|
25
|
+
def self.build
|
26
|
+
new.tap do |instance|
|
27
|
+
instance.dir = Dir
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Pathname]
|
32
|
+
def call
|
33
|
+
return Pathname.new("/dev/null") if dir.nil?
|
34
|
+
|
35
|
+
path_as_text = dir.pwd
|
36
|
+
Pathname.new(path_as_text)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.call
|
40
|
+
instance = build
|
41
|
+
instance.()
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "fried/test/telemetry"
|
3
|
+
|
4
|
+
module Fried
|
5
|
+
module Test
|
6
|
+
module Directory
|
7
|
+
# Behaves like {Dir.glob}
|
8
|
+
class GetFilesByPattern
|
9
|
+
class Substitute
|
10
|
+
include ::Fried::Test::Telemetry
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :files
|
15
|
+
|
16
|
+
public
|
17
|
+
|
18
|
+
def initialize(files = [])
|
19
|
+
@files = files
|
20
|
+
end
|
21
|
+
|
22
|
+
def call(pattern, flag = 0)
|
23
|
+
record :call, [pattern, flag]
|
24
|
+
files.map(&:to_s)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_accessor :dir
|
29
|
+
|
30
|
+
def self.build
|
31
|
+
new.tap do |instance|
|
32
|
+
instance.dir = Dir
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# @see Dir.glob
|
37
|
+
# @return [Array<String>]
|
38
|
+
def call(pattern, flags = 0)
|
39
|
+
return [] if dir.nil?
|
40
|
+
|
41
|
+
dir.glob(pattern, flags)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.call
|
45
|
+
instance = build
|
46
|
+
instance.()
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "fried/test/directory/current_working_directory"
|
3
|
+
|
4
|
+
module Fried
|
5
|
+
module Test
|
6
|
+
class GetTestDirectory
|
7
|
+
class Substitute
|
8
|
+
private
|
9
|
+
|
10
|
+
attr_reader :test_path
|
11
|
+
|
12
|
+
public
|
13
|
+
|
14
|
+
def initialize(test_path)
|
15
|
+
@test_path = test_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
Pathname.new(test_path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_accessor :current_working_directory
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@current_working_directory = Directory::CurrentWorkingDirectory.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.build
|
30
|
+
new.tap do |instance|
|
31
|
+
cwd = Directory::CurrentWorkingDirectory.build
|
32
|
+
|
33
|
+
instance.current_working_directory = cwd
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [Pathname]
|
38
|
+
def call
|
39
|
+
path = current_working_directory.()
|
40
|
+
path.join("./test")
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.call
|
44
|
+
instance = build
|
45
|
+
instance.()
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "fried/test/directory/get_files_by_pattern"
|
3
|
+
require "fried/test/get_test_directory"
|
4
|
+
|
5
|
+
module Fried
|
6
|
+
module Test
|
7
|
+
# Get absolute path to all test files for current working directory
|
8
|
+
class GetTestFiles
|
9
|
+
GlobPattern = Pathname.new("./**/*_test.rb").freeze
|
10
|
+
|
11
|
+
attr_accessor :get_files_by_pattern
|
12
|
+
attr_accessor :get_test_directory
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@get_files_by_pattern = Directory::GetFilesByPattern.new
|
16
|
+
@get_test_directory = GetTestDirectory.new
|
17
|
+
end
|
18
|
+
|
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
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [Enumerator<Pathname>]
|
27
|
+
def call
|
28
|
+
directory = get_test_directory.()
|
29
|
+
pattern = directory.join(GlobPattern)
|
30
|
+
|
31
|
+
files = get_files_by_pattern.(pattern.to_s)
|
32
|
+
files.map! { |file| directory.join(file) }
|
33
|
+
files.each
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.call
|
37
|
+
instance = build
|
38
|
+
instance.()
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "fried/test/get_test_files"
|
2
|
+
|
3
|
+
module Fried
|
4
|
+
module Test
|
5
|
+
# Load test files using {require_relative}
|
6
|
+
class LoadTestFiles
|
7
|
+
class Substitute
|
8
|
+
include ::Fried::Test::Telemetry
|
9
|
+
|
10
|
+
def call
|
11
|
+
record :call
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :get_test_files
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@get_test_files = GetTestFiles.new
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build
|
23
|
+
new.tap do |instance|
|
24
|
+
instance.get_test_files = GetTestFiles.build
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
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
|
+
|
34
|
+
def self.call
|
35
|
+
instance = build
|
36
|
+
instance.()
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "fried/test/get_test_directory"
|
2
|
+
require "fried/test/prepend_to_load_path"
|
3
|
+
|
4
|
+
module Fried
|
5
|
+
module Test
|
6
|
+
# Puts tests path into {$LOAD_PATH}
|
7
|
+
class LoadTestsPath
|
8
|
+
class Substitute
|
9
|
+
include ::Fried::Test::Telemetry
|
10
|
+
|
11
|
+
def call
|
12
|
+
record :call
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_accessor :get_test_directory
|
18
|
+
attr_accessor :prepend_to_load_path
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@get_test_directory = GetTestDirectory.new
|
22
|
+
@prepend_to_load_path = PrependToLoadPath.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.build
|
26
|
+
new.tap do |instance|
|
27
|
+
instance.get_test_directory = GetTestDirectory.build
|
28
|
+
instance.prepend_to_load_path = PrependToLoadPath.build
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param [Void]
|
33
|
+
def call
|
34
|
+
lib = get_test_directory.()
|
35
|
+
prepend_to_load_path.(lib)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.call
|
39
|
+
instance = build
|
40
|
+
instance.()
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fried
|
2
|
+
module Test
|
3
|
+
# Unshifts the path to {$LOAD_PATH} unless already existing
|
4
|
+
class PrependToLoadPath
|
5
|
+
attr_accessor :load_path
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@load_path = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.build
|
12
|
+
new.tap do |instance|
|
13
|
+
instance.load_path = $LOAD_PATH
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param path [String, Pathname]
|
18
|
+
# @return [Boolean] {true} if path was added, {false} if already present
|
19
|
+
def call(path)
|
20
|
+
text_path = path.to_s
|
21
|
+
|
22
|
+
has_path = load_path.include?(text_path)
|
23
|
+
load_path.unshift(text_path) unless has_path
|
24
|
+
|
25
|
+
!has_path
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.call
|
29
|
+
instance = build
|
30
|
+
instance.()
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fried
|
2
|
+
module Test
|
3
|
+
module Telemetry
|
4
|
+
Record = Struct.new(:signal, :time, :data)
|
5
|
+
|
6
|
+
def record(signal, data = nil)
|
7
|
+
@__telemetry_records__ ||= []
|
8
|
+
time = Time.now.utc
|
9
|
+
@__telemetry_records__ << Record.new(signal, time, data)
|
10
|
+
end
|
11
|
+
|
12
|
+
def recorded?(signal)
|
13
|
+
@__telemetry_records__.any? do |recorded|
|
14
|
+
recorded.signal == signal
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def recorded_with?(signal, data)
|
19
|
+
@__telemetry_records__.any? do |recorded|
|
20
|
+
recorded.signal == signal &&
|
21
|
+
recorded.data == data
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def recorded_times?(signal, amount)
|
26
|
+
@__telemetry_records__.count do |recorded|
|
27
|
+
recorded.signal == signal
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/fried/test.rb
ADDED
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fried-test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fire-Dragon-DoL
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
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: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
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'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-reporters
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Minitest helpers and testing philosophy
|
84
|
+
email:
|
85
|
+
- francesco.belladonna@gmail.com
|
86
|
+
executables:
|
87
|
+
- friest
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- exe/friest
|
100
|
+
- fried-test.gemspec
|
101
|
+
- lib/fried/test.rb
|
102
|
+
- lib/fried/test/activate.rb
|
103
|
+
- lib/fried/test/autorun.rb
|
104
|
+
- lib/fried/test/cli.rb
|
105
|
+
- lib/fried/test/directory/current_working_directory.rb
|
106
|
+
- lib/fried/test/directory/get_files_by_pattern.rb
|
107
|
+
- lib/fried/test/get_test_directory.rb
|
108
|
+
- lib/fried/test/get_test_files.rb
|
109
|
+
- lib/fried/test/load_test_files.rb
|
110
|
+
- lib/fried/test/load_tests_path.rb
|
111
|
+
- lib/fried/test/noop.rb
|
112
|
+
- lib/fried/test/prepend_to_load_path.rb
|
113
|
+
- lib/fried/test/telemetry.rb
|
114
|
+
- lib/fried/test/version.rb
|
115
|
+
homepage: https://github.com/Fire-Dragon-DoL/fried-test
|
116
|
+
licenses: []
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.6.14
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Minitest helpers and testing philosophy
|
138
|
+
test_files: []
|