rast 0.4.2.pre → 0.6.0.pre

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: c4c0904a8baf8935d4b5406684e613f7626c7ca9fdbe4cc17e99a2ae09ecdd53
4
- data.tar.gz: 239da4c4e5e41afb4429a2051dc2d0b2ed32e85f02ae32e646e194ff6ebc1a62
3
+ metadata.gz: 8b708941b4f497bb2d44a7cecc41bc844461668c0ddf9eb60a4b144f369dd52e
4
+ data.tar.gz: 98d80de81bac24dad2758a067764dfd0ed94797bb287bd3123e73d3b1ded81f2
5
5
  SHA512:
6
- metadata.gz: 9b4f4c9257e3db7fcb50e89053a66ca25a17feda4cb815fe35dec89e00001f38e19e3b35854b1c8ecd1c07079922efc2947dd57a10ee0b9ba930cb1db7b8de17
7
- data.tar.gz: e2c3c03e3fffb117112f25c5307e4928bd059109f1e54c9fd5077ebf0bb9be6fdba6c38fe4d98adb02694e888b093346fc3062c0913239445dbde6f91beda541
6
+ metadata.gz: 6517e83a1f82f3882a85a8045b74e050e007bcab59d680b966c20653ab1c46b9b0b29d4279d8717ea390dc418ec0c77c010456fdd385ef5f46f1a0529773092c
7
+ data.tar.gz: c30acef08531bd2abbdcfc01fa7ba972851c3e2e805b7e2f839b356f1d58113bb672849f27c18b335d53ab8f1e4f1afea6767cf569e7705df12e30fe93b214e2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Change log
2
2
 
3
+ - 0.6.0.pre - Reverted redesign.
4
+ - 0.5.0.pre - Redesigned to have subject as first block parameter. Everything inside
5
+ the prepare block now runs under the context of RSpec.
3
6
  - 0.4.2.pre - Fix 4 tokens bug, due to mis-configured converters
4
7
  - 0.4.1.pre - Fix negative? invocation.
5
8
  - 0.4.0.pre - Allow yaml-less configuration.
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Example
4
+ class DoubleExample
5
+ def sim();end
6
+
7
+ def process
8
+ return false if sim.nil?
9
+
10
+ sim.best?
11
+ end
12
+ end
data/lib/rast/spec_dsl.rb CHANGED
@@ -127,18 +127,13 @@ def generate_rspec(scope: nil, scenario: {}, expected: '')
127
127
  it "[#{expected}]=[#{spec_params}]" do
128
128
  block_params = scenario.values
129
129
 
130
- if scope.rspec_methods.size > 0 || !scope.prepare_block.nil?
131
- scope.prepare_block.call(*block_params)
130
+ @mysubject = scope.subject
131
+ class << self
132
+ define_method(:subject) { @mysubject }
132
133
  end
133
134
 
134
- while scope.rspec_methods.any?
135
- first_meth = scope.rspec_methods.shift
136
- second_meth = scope.rspec_methods.shift
137
- if first_meth[:name] == :allow && second_meth[:name] == :receive
138
- allow(scope.subject)
139
- .to receive(second_meth[:args], &second_meth[:block])
140
- end
141
- scope.rspec_methods.shift
135
+ if scope.rspec_methods.size > 0 || !scope.prepare_block.nil?
136
+ instance_exec(*block_params, &scope.prepare_block)
142
137
  end
143
138
 
144
139
  actual = scope.execute_block.call(*block_params).to_s
data/rast.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'rast'
5
- spec.version = '0.4.2.pre'
5
+ spec.version = '0.6.0.pre'
6
6
  spec.authors = ['Royce Remulla']
7
7
  spec.email = ['royce.com@gmail.com']
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2.pre
4
+ version: 0.6.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Royce Remulla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Extends RSpec functionality by using the catch-all-scenario testing (CAST)
14
14
  principle.
@@ -26,6 +26,7 @@ files:
26
26
  - Gemfile.lock
27
27
  - README.md
28
28
  - examples/arithmetic_module.rb
29
+ - examples/double_example.rb
29
30
  - examples/factory_example.rb
30
31
  - examples/logic_checker.rb
31
32
  - examples/logic_four.rb