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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d937f702b24f432fa7a241bd2fdd4f01a6119f6da79f98f1efd3e5f726cba22
4
- data.tar.gz: 297733864622a5a0032918a9c6d83bac21e90df4b141c5898e7309a248cb1982
3
+ metadata.gz: 659b5228eb82a76f457af1da9a275cfdcc5914f03d40083fdca08f79c8b1fac6
4
+ data.tar.gz: d89c4ee71c95dc202adf14110a140f9f4d667698f0e8b443a884226b6881e57d
5
5
  SHA512:
6
- metadata.gz: e6bb5da0e65a04f60292ee4b74184e02081571eaf942c915eb239a9b98b7bb9f420d7a4da0b2fbacb9f370fb0769b2336deee1686fe250c5793953fe7ba8ed41
7
- data.tar.gz: 6c1a3721ed8a8d41bc65583812a9abafeacf251dba910867b3567addb412c646237f64c68971a0cbc87e38f0abdaaeb8b652139c9f0b8a412e92dfae9c4e5609
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
@@ -1,3 +1,3 @@
1
1
  module Uspec
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.2'
3
3
  end
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
@@ -0,0 +1,5 @@
1
+ @an_instance_variable = true
2
+
3
+ spec "method spec" do
4
+ @an_instance_variable
5
+ end
@@ -0,0 +1,10 @@
1
+ def format
2
+ yield
3
+ true
4
+ end
5
+
6
+ spec "method spec" do
7
+ format do
8
+ false
9
+ end
10
+ 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.0
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-19 00:00:00.000000000 Z
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