uspec 1.1.0 → 1.1.1
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/lib/uspec/dsl.rb +5 -0
- data/lib/uspec/version.rb +1 -1
- data/uspec/dsl_spec.rb +21 -0
- data/uspec/test_specs/ivar_spec +5 -0
- data/uspec/test_specs/method_spec +7 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb801d9f4456d3cfe7c0d08c3cb944f4ba7dd1a2760760314756474bca01269c
|
4
|
+
data.tar.gz: 5321cad9b683f3f95cd681dab3c9177271c38f8e69bb80b7879a4e4bca31c837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91e01712aae2a1a5690b58075e9dcdfe9e86e67fc64baf5aca5f0e80c60a9a058812cd11e0412e6a8553f9ef9e5496120533871c3a07cf4eabf412fe7499f795
|
7
|
+
data.tar.gz: '09ff01aa543dcc4b2951735642cdbb12a95bfb347f1ce112162f7666a08257fcbc026da9d043c071bc36c4a6e315c22e292b2e4fc1f9417f8005a4d833718582'
|
data/lib/uspec/dsl.rb
CHANGED
@@ -5,6 +5,7 @@ module Uspec
|
|
5
5
|
USPEC_CLI_BLOCK = -> { @__uspec_dsl.__uspec_cli }
|
6
6
|
USPEC_STAT_BLOCK = -> { @__uspec_dsl.__uspec_cli.stats }
|
7
7
|
USPEC_SPEC_BLOCK = ->(description, &block) { @__uspec_dsl.spec description, &block }
|
8
|
+
USPEC_MM_BLOCK = ->(name, *args) { @__uspec_dsl.methods(false).include?(name) && @__uspec_dsl.send(name, *args) || super }
|
8
9
|
|
9
10
|
def initialize cli
|
10
11
|
@__uspec_cli = cli
|
@@ -26,6 +27,10 @@ module Uspec
|
|
26
27
|
o.instance_variable_set :@__uspec_dsl, self
|
27
28
|
o.define_singleton_method :spec, USPEC_SPEC_BLOCK
|
28
29
|
o.define_singleton_method :spec_block, &block
|
30
|
+
o.define_singleton_method :method_missing, USPEC_MM_BLOCK
|
31
|
+
self.instance_variables.each do |name|
|
32
|
+
o.instance_variable_set(name, self.instance_variable_get(name)) unless name.to_s.include? '@__uspec'
|
33
|
+
end
|
29
34
|
o.spec_block
|
30
35
|
end
|
31
36
|
|
data/lib/uspec/version.rb
CHANGED
data/uspec/dsl_spec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative "uspec_helper"
|
2
|
+
|
3
|
+
spec 'when instance variables are defined in the DSL instance, they are available in the spec body' do
|
4
|
+
path = Pathname.new(__FILE__).parent.join('test_specs', 'ivar_spec')
|
5
|
+
|
6
|
+
output = capture do
|
7
|
+
exec "bin/uspec #{path}"
|
8
|
+
end
|
9
|
+
|
10
|
+
output.include?('1 successful') || output
|
11
|
+
end
|
12
|
+
|
13
|
+
spec 'when methods are defined in the DSL instance, they are available in the spec body' do
|
14
|
+
path = Pathname.new(__FILE__).parent.join('test_specs', 'method_spec')
|
15
|
+
|
16
|
+
output = capture do
|
17
|
+
exec "bin/uspec #{path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
output.include?('1 successful') || output
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony M. Cook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: that_object_is_so_basic
|
@@ -84,10 +84,13 @@ files:
|
|
84
84
|
- lib/uspec/version.rb
|
85
85
|
- uspec.gemspec
|
86
86
|
- uspec/cli_spec.rb
|
87
|
+
- uspec/dsl_spec.rb
|
87
88
|
- uspec/jump_spec.rb
|
88
89
|
- uspec/result_spec.rb
|
89
90
|
- uspec/test_specs/break_spec
|
90
91
|
- uspec/test_specs/broken_require_spec
|
92
|
+
- uspec/test_specs/ivar_spec
|
93
|
+
- uspec/test_specs/method_spec
|
91
94
|
- uspec/test_specs/pending_spec
|
92
95
|
- uspec/test_specs/return_spec
|
93
96
|
- uspec/test_specs/value_spec
|