bddsm 0.1.0 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bddsm +24 -3
- data/lib/bddsm/describe.rb +9 -0
- data/lib/bddsm/execution.rb +14 -0
- data/lib/bddsm/progress_report.rb +1 -1
- data/lib/bddsm/result.rb +2 -0
- data/lib/bddsm/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 286db37e9ca23e50fd515d76f7d4c1125768ccf9390bc15c9a2d4e6a4daa2ae9
|
4
|
+
data.tar.gz: 6c56c3a8bbfc73a246d900abdb1b9fabae64aa9c386cfd1f775ced50741ae4e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2db0f86b9ec74677e46e0e113d2d71cd0091ae1a37cc18aef62fef5c68befca6df11552a3bfd0b6f05c8d3cc76f5c20cbcb336d241231e307971a85ffdf7867f
|
7
|
+
data.tar.gz: dbc2f110f069a8d50d117077cd930abf98477daf73c2b8a94e8ce34f6b2f1a01ffc3e3a3a501a1f676e38f649488db7bc11ae05722b10353de09b99964c29b02
|
data/bin/bddsm
CHANGED
@@ -3,7 +3,28 @@
|
|
3
3
|
require 'pathname'
|
4
4
|
require_relative '../lib/bddsm'
|
5
5
|
|
6
|
-
|
6
|
+
def add_all_test_files(path_pattern)
|
7
|
+
Dir.glob(path_pattern).each do |file|
|
8
|
+
BDDSM::Suite.instance.add_path(Pathname.new(file))
|
9
|
+
end
|
10
|
+
end
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
def add_single_test_file(file_path)
|
13
|
+
test_file = Pathname.new(__dir__).join('..', file_path)
|
14
|
+
BDDSM::Suite.instance.add_path(test_file)
|
15
|
+
end
|
16
|
+
|
17
|
+
if ARGV.empty?
|
18
|
+
test_dir = Pathname.new(__dir__).join('..', 'test', '**', '*_spec.rb')
|
19
|
+
add_all_test_files(test_dir)
|
20
|
+
else
|
21
|
+
add_single_test_file(ARGV[0])
|
22
|
+
end
|
23
|
+
|
24
|
+
BDDSM::Suite.instance.run
|
25
|
+
|
26
|
+
if BDDSM::Suite.instance.result.success?
|
27
|
+
exit 0
|
28
|
+
else
|
29
|
+
exit 1
|
30
|
+
end
|
data/lib/bddsm/describe.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
module BDDSM
|
2
2
|
class Describe
|
3
|
+
attr_reader :memoized_lets
|
4
|
+
|
3
5
|
def initialize(title, &block)
|
4
6
|
@title = title
|
5
7
|
@block = block
|
8
|
+
@memoized_lets = {}
|
6
9
|
end
|
7
10
|
|
8
11
|
def run
|
@@ -12,5 +15,11 @@ module BDDSM
|
|
12
15
|
def it(&)
|
13
16
|
Execution.new(describe: self, &).run
|
14
17
|
end
|
18
|
+
|
19
|
+
def let(name, &)
|
20
|
+
singleton_class.instance_eval { attr_accessor name.to_sym } unless respond_to?(name.to_sym)
|
21
|
+
@memoized_lets[name] = instance_exec(&)
|
22
|
+
instance_variable_set("@#{name}", @memoized_lets[name])
|
23
|
+
end
|
15
24
|
end
|
16
25
|
end
|
data/lib/bddsm/execution.rb
CHANGED
@@ -2,7 +2,9 @@ module BDDSM
|
|
2
2
|
class Execution
|
3
3
|
def initialize(describe:, &block)
|
4
4
|
@describe = describe
|
5
|
+
@memoized_lets ||= {}
|
5
6
|
@block = block
|
7
|
+
memoized
|
6
8
|
end
|
7
9
|
|
8
10
|
def run
|
@@ -18,5 +20,17 @@ module BDDSM
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def location = @block.source_location
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def memoized
|
27
|
+
return unless @describe.memoized_lets
|
28
|
+
|
29
|
+
@describe.memoized_lets.each do |k, v|
|
30
|
+
self.class.define_method(k) do
|
31
|
+
@memoized_lets[k] ||= v
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
21
35
|
end
|
22
36
|
end
|
data/lib/bddsm/result.rb
CHANGED
data/lib/bddsm/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bddsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei O. Udalov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
email:
|
13
|
+
description:
|
14
|
+
email:
|
15
15
|
executables:
|
16
16
|
- bddsm
|
17
17
|
extensions: []
|
@@ -33,7 +33,7 @@ homepage: https://github.com/HeavyTechRuby/bddsm
|
|
33
33
|
licenses: []
|
34
34
|
metadata:
|
35
35
|
rubygems_mfa_required: 'true'
|
36
|
-
post_install_message:
|
36
|
+
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
@@ -48,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
|
-
rubygems_version: 3.
|
52
|
-
signing_key:
|
51
|
+
rubygems_version: 3.4.19
|
52
|
+
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Hard Testing Framework. Multi-paradigm spec/feature/xunit-agnostic syntax
|
55
55
|
support.
|