fix 1.0.0.beta9 → 1.0.0.beta10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/fix/dsl.rb +6 -4
- data/lib/fix/matcher.rb +3 -1
- data/lib/fix/set.rb +25 -50
- data/lib/kernel.rb +3 -2
- metadata +5 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0a01072f39d7c105aff0bde77c97ce31c9aae8a1144e29a00b9098017cb436
|
4
|
+
data.tar.gz: cab7ff1e39fc58599b712ff53597534535e86bf1422f0f10c926e14d1e267e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f831b90a8faaabf56db03f17d03905e6c41eb18e0f1873db78e0de30540e46b4b395c7fb19f80b3ccbc6b3e560978c42fb0ff8066b6b912151f2785249b51b
|
7
|
+
data.tar.gz: 4b1f58e67584042977f803b53119d090e76f9848b6b470a86aeefaa5f5a195afe11f3ab98d3383e1c5e1e819ff570b890bff58aa734d2c19c6e3079d75a95ffd
|
data/README.md
CHANGED
data/lib/fix/dsl.rb
CHANGED
@@ -22,8 +22,9 @@ module Fix
|
|
22
22
|
# let(:name) { "Bob" }
|
23
23
|
# end
|
24
24
|
#
|
25
|
-
# @param name
|
26
|
-
# @
|
25
|
+
# @param name [String, Symbol] The name of the property.
|
26
|
+
# @yield The block that defines the property's value
|
27
|
+
# @yieldreturn [Object] The value to be returned by the property
|
27
28
|
#
|
28
29
|
# @return [Symbol] A private method that define the block content.
|
29
30
|
#
|
@@ -39,13 +40,14 @@ module Fix
|
|
39
40
|
# require "fix"
|
40
41
|
#
|
41
42
|
# Fix do
|
42
|
-
# with :
|
43
|
+
# with password: "secret" do
|
43
44
|
# it MUST be true
|
44
45
|
# end
|
45
46
|
# end
|
46
47
|
#
|
47
48
|
# @param kwargs [Hash] The list of propreties.
|
48
|
-
# @
|
49
|
+
# @yield The block that defines the specs for this context
|
50
|
+
# @yieldreturn [void]
|
49
51
|
#
|
50
52
|
# @api public
|
51
53
|
def self.with(**kwargs, &)
|
data/lib/fix/matcher.rb
CHANGED
@@ -195,7 +195,9 @@ module Fix
|
|
195
195
|
# matcher = satisfy { |value| value == 42 }
|
196
196
|
# matcher.matches? { 42 } # => true
|
197
197
|
#
|
198
|
-
# @
|
198
|
+
# @yield [value] A block that defines the satisfaction criteria
|
199
|
+
# @yieldparam value The value to test
|
200
|
+
# @yieldreturn [Boolean] true if the value satisfies the criteria
|
199
201
|
#
|
200
202
|
# @return [#matches?] A satisfy matcher.
|
201
203
|
#
|
data/lib/fix/set.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "English"
|
4
|
+
|
3
5
|
require_relative "doc"
|
4
6
|
require_relative "run"
|
5
7
|
|
@@ -8,85 +10,58 @@ module Fix
|
|
8
10
|
#
|
9
11
|
# @api private
|
10
12
|
class Set
|
11
|
-
# The type of result.
|
12
|
-
#
|
13
|
-
# Passed expectations can be classified as:
|
14
|
-
#
|
15
|
-
# * `success`
|
16
|
-
# * `warning`
|
17
|
-
# * `info`
|
18
|
-
#
|
19
|
-
# Failed expectations can be classified as:
|
20
|
-
#
|
21
|
-
# * `failure`
|
22
|
-
# * `error`
|
23
|
-
LOG_LEVELS = %w[
|
24
|
-
none
|
25
|
-
error
|
26
|
-
failure
|
27
|
-
warning
|
28
|
-
info
|
29
|
-
success
|
30
|
-
].freeze
|
31
|
-
|
32
13
|
# @return [Array] A list of specifications.
|
33
14
|
attr_reader :specs
|
34
15
|
|
16
|
+
# Load specifications from a constant name.
|
17
|
+
#
|
35
18
|
# @param name [String, Symbol] The constant name of the specifications.
|
19
|
+
# @return [Set] A new Set instance containing the loaded specifications.
|
36
20
|
#
|
37
21
|
# @api public
|
38
22
|
def self.load(name)
|
39
23
|
new(*Doc.fetch(name))
|
40
24
|
end
|
41
25
|
|
26
|
+
# Initialize a new Set with given contexts.
|
27
|
+
#
|
42
28
|
# @param contexts [Array<::Fix::Dsl>] The list of contexts document.
|
43
29
|
def initialize(*contexts)
|
44
|
-
@specs
|
45
|
-
@passed = true
|
30
|
+
@specs = Doc.specs(*contexts).shuffle
|
46
31
|
end
|
47
32
|
|
48
|
-
#
|
33
|
+
# Run the test suite against the provided subject.
|
49
34
|
#
|
35
|
+
# @yield The block of code to be tested
|
36
|
+
# @yieldreturn [Object] The result of the code being tested
|
37
|
+
# @return [Boolean] true if all tests pass, exits with false otherwise
|
50
38
|
# @raise [::SystemExit] The test set failed!
|
51
39
|
#
|
52
40
|
# @api public
|
53
|
-
def test(
|
54
|
-
|
55
|
-
|
56
|
-
specs.each do |environment, location, requirement, challenges|
|
57
|
-
runner = Run.new(environment, requirement, *challenges)
|
58
|
-
result = runner.test(&subject)
|
59
|
-
|
60
|
-
failed! if result.failed?
|
61
|
-
report!(location, result, log_level:)
|
62
|
-
end
|
63
|
-
|
64
|
-
passed? || ::Kernel.exit(false)
|
41
|
+
def test(&)
|
42
|
+
suite_passed?(&) || ::Kernel.exit(false)
|
65
43
|
end
|
66
44
|
|
67
45
|
private
|
68
46
|
|
69
|
-
def
|
70
|
-
specs.
|
47
|
+
def suite_passed?(&subject)
|
48
|
+
specs.all? { |spec| run_spec(*spec, &subject) }
|
71
49
|
end
|
72
50
|
|
73
|
-
def
|
74
|
-
|
51
|
+
def run_spec(env, location, requirement, challenges, &subject)
|
52
|
+
::Process.fork { lab(env, location, requirement, challenges, &subject) }
|
53
|
+
::Process.wait
|
54
|
+
$CHILD_STATUS.success?
|
75
55
|
end
|
76
56
|
|
77
|
-
|
78
|
-
|
79
|
-
|
57
|
+
def lab(env, location, requirement, challenges, &)
|
58
|
+
result = Run.new(env, requirement, *challenges).test(&)
|
59
|
+
report!(location, result)
|
60
|
+
::Kernel.exit(result.passed?)
|
80
61
|
end
|
81
62
|
|
82
|
-
def report!(path, result
|
83
|
-
return unless report?(result, log_level:)
|
84
|
-
|
63
|
+
def report!(path, result)
|
85
64
|
puts "#{path} #{result.colored_string}"
|
86
65
|
end
|
87
|
-
|
88
|
-
def report?(result, log_level:)
|
89
|
-
LOG_LEVELS[1..log_level].any? { |name| result.public_send(:"#{name}?") }
|
90
|
-
end
|
91
66
|
end
|
92
67
|
end
|
data/lib/kernel.rb
CHANGED
@@ -19,8 +19,9 @@ module Kernel
|
|
19
19
|
# # A test
|
20
20
|
# Fix[:Answer].test { 42 }
|
21
21
|
#
|
22
|
-
# @param name
|
23
|
-
# @
|
22
|
+
# @param name [String, Symbol] The constant name of the specifications.
|
23
|
+
# @yield The specifications block that defines the test requirements
|
24
|
+
# @yieldreturn [void]
|
24
25
|
#
|
25
26
|
# @return [#test] The collection of specifications.
|
26
27
|
#
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: defi
|
@@ -77,7 +76,6 @@ metadata:
|
|
77
76
|
source_code_uri: https://github.com/fixrb/fix
|
78
77
|
wiki_uri: https://github.com/fixrb/fix/wiki
|
79
78
|
rubygems_mfa_required: 'true'
|
80
|
-
post_install_message:
|
81
79
|
rdoc_options: []
|
82
80
|
require_paths:
|
83
81
|
- lib
|
@@ -88,12 +86,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
86
|
version: 3.2.0
|
89
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
88
|
requirements:
|
91
|
-
- - "
|
89
|
+
- - ">="
|
92
90
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
91
|
+
version: '0'
|
94
92
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
96
|
-
signing_key:
|
93
|
+
rubygems_version: 3.6.2
|
97
94
|
specification_version: 4
|
98
95
|
summary: Specing framework.
|
99
96
|
test_files: []
|