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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d937f702b24f432fa7a241bd2fdd4f01a6119f6da79f98f1efd3e5f726cba22
4
- data.tar.gz: 297733864622a5a0032918a9c6d83bac21e90df4b141c5898e7309a248cb1982
3
+ metadata.gz: cb801d9f4456d3cfe7c0d08c3cb944f4ba7dd1a2760760314756474bca01269c
4
+ data.tar.gz: 5321cad9b683f3f95cd681dab3c9177271c38f8e69bb80b7879a4e4bca31c837
5
5
  SHA512:
6
- metadata.gz: e6bb5da0e65a04f60292ee4b74184e02081571eaf942c915eb239a9b98b7bb9f420d7a4da0b2fbacb9f370fb0769b2336deee1686fe250c5793953fe7ba8ed41
7
- data.tar.gz: 6c1a3721ed8a8d41bc65583812a9abafeacf251dba910867b3567addb412c646237f64c68971a0cbc87e38f0abdaaeb8b652139c9f0b8a412e92dfae9c4e5609
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
@@ -1,3 +1,3 @@
1
1
  module Uspec
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
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,7 @@
1
+ def a_method
2
+ true
3
+ end
4
+
5
+ spec "method spec" do
6
+ a_method
7
+ 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.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-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