cutest-cj 1.6.4 → 1.7.0
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/cutest.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b82e6938d5650a90190748359cca83ed52f1f52
|
4
|
+
data.tar.gz: 4e236fa33bba4f0c42803d9831e1bb7e6f533edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 770fb54483a9d5e230ab9143aead6d5b960423615f27d7abebe0891c4cfd6934f968be76d85281d4e476865b8e2942e741b9618e475fcfb8508a09b7cd5c9625
|
7
|
+
data.tar.gz: 393bd14d01d5639e1e75582dc94fb1a3facf19b33d0ad6a9949a61ed74ff6e9db75cad780917345c05d14d298d42998b6e7a9fe30c84f88c1007e51785d9db21
|
data/lib/cutest.rb
CHANGED
@@ -7,7 +7,7 @@ class Cutest
|
|
7
7
|
autoload :Database, 'cutest/database'
|
8
8
|
|
9
9
|
unless defined?(VERSION)
|
10
|
-
VERSION = "1.
|
10
|
+
VERSION = "1.7.0"
|
11
11
|
FILTER = %r[/(ruby|jruby|rbx)[-/]([0-9\.])+]
|
12
12
|
CACHE = Hash.new { |h, k| h[k] = File.readlines(k) }
|
13
13
|
end
|
@@ -169,7 +169,7 @@ module Kernel
|
|
169
169
|
|
170
170
|
# Use Thread.current[:cutest] to store information about test preparation
|
171
171
|
# and setup.
|
172
|
-
Thread.current[:cutest] ||= { :prepare => [] }
|
172
|
+
Thread.current[:cutest] ||= { :prepare => [], :before => [], :after => [] }
|
173
173
|
|
174
174
|
# Shortcut to access Thread.current[:cutest].
|
175
175
|
def cutest
|
@@ -196,6 +196,18 @@ module Kernel
|
|
196
196
|
cutest[:prepare]
|
197
197
|
end
|
198
198
|
|
199
|
+
# Unlike prepare this gets evaled before each test
|
200
|
+
def before(&block)
|
201
|
+
cutest[:before] << block if block_given?
|
202
|
+
cutest[:before]
|
203
|
+
end
|
204
|
+
|
205
|
+
# Unlike prepare this gets evaled after each test
|
206
|
+
def before(&block)
|
207
|
+
cutest[:after] << block if block_given?
|
208
|
+
cutest[:after]
|
209
|
+
end
|
210
|
+
|
199
211
|
# Setup parameters for the tests. The block passed to setup is evaluated
|
200
212
|
# before running each test, and the result of the setup block is passed to
|
201
213
|
# the test as a parameter. If the setup and the tests are declared at the
|
@@ -253,7 +265,9 @@ module Kernel
|
|
253
265
|
print ' '
|
254
266
|
time_taken = Benchmark.measure do
|
255
267
|
prepare.each { |blk| blk.call }
|
268
|
+
before.each { |blk| self.instance_eval blk }
|
256
269
|
block.call(setup && self.instance_eval(&setup))
|
270
|
+
after.each { |blk| self.instance_eval blk }
|
257
271
|
end
|
258
272
|
puts ''
|
259
273
|
puts " \033[93mTest: \033[0m#{cutest[:test]} \033[32m✔\033[0m"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutest-cj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damian Janowski
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-08-
|
13
|
+
date: 2014-08-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|