uspec 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uspec/dsl.rb +8 -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 +10 -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: 659b5228eb82a76f457af1da9a275cfdcc5914f03d40083fdca08f79c8b1fac6
|
4
|
+
data.tar.gz: d89c4ee71c95dc202adf14110a140f9f4d667698f0e8b443a884226b6881e57d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021b318bd832f4c5f290db67bca30a05e8e545fcc9b633506ab63ce2dc55cf53389885bc42d956e007f76d44245817aaa915f35f940b514eca43cbde32cc0c2a
|
7
|
+
data.tar.gz: 44f6373981caa474dbb6df5f48f9fcf38c9fc3d59f680e6198940f758c098f4157ce30dc6ad13294cb3bca99c7f659ca60395d5760b11830905144368ef5a8b0
|
data/lib/uspec/dsl.rb
CHANGED
@@ -26,6 +26,14 @@ module Uspec
|
|
26
26
|
o.instance_variable_set :@__uspec_dsl, self
|
27
27
|
o.define_singleton_method :spec, USPEC_SPEC_BLOCK
|
28
28
|
o.define_singleton_method :spec_block, &block
|
29
|
+
self.instance_variables.each do |name|
|
30
|
+
o.instance_variable_set(name, self.instance_variable_get(name)) unless name.to_s.include? '@__uspec'
|
31
|
+
end
|
32
|
+
self.methods(false).each do |name|
|
33
|
+
o.define_singleton_method name do |*args, &block|
|
34
|
+
@__uspec_dsl.send name, *args, &block
|
35
|
+
end unless name.to_s.include? '__uspec'
|
36
|
+
end
|
29
37
|
o.spec_block
|
30
38
|
end
|
31
39
|
|
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.2
|
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
|