dfect 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +2 -2
- data/HISTORY +306 -0
- data/INSTALL +35 -0
- data/README +95 -0
- data/USAGE +393 -0
- data/doc/api/Dfect.html +3179 -0
- data/doc/api/Object.html +107 -0
- data/doc/api/_index.html +107 -0
- data/doc/api/class_list.html +36 -0
- data/doc/api/css/common.css +1 -0
- data/doc/api/css/full_list.css +50 -0
- data/doc/api/css/style.css +268 -0
- data/doc/api/file.LICENSE.html +73 -0
- data/doc/api/file_list.html +38 -0
- data/doc/api/frames.html +13 -0
- data/doc/api/index.html +72 -13
- data/doc/api/js/app.js +99 -0
- data/doc/api/js/full_list.js +106 -0
- data/doc/api/js/{jquery-1.3.2.min.js → jquery.js} +0 -0
- data/doc/api/method_list.html +339 -0
- data/doc/api/top-level-namespace.html +87 -0
- data/doc/index.erb +16 -9
- data/doc/index.html +1057 -726
- data/lib/dfect.rb +431 -284
- data/lib/dfect/auto.rb +2 -6
- data/lib/dfect/inochi.rb +48 -0
- data/lib/dfect/inochi.yaml +75 -0
- data/lib/dfect/mini.rb +1 -5
- data/lib/dfect/spec.rb +6 -13
- data/lib/dfect/unit.rb +21 -33
- data/test/dfect/inochi_test.rb +17 -0
- data/test/{dfect.rb → dfect_test.rb} +167 -7
- data/test/runner +25 -0
- data/test/test_helper.rb +1 -0
- metadata +43 -55
- data/doc/api/apple-touch-icon.png +0 -0
- data/doc/api/classes/Class.html +0 -73
- data/doc/api/classes/Dfect.html +0 -1245
- data/doc/api/classes/Kernel.html +0 -322
- data/doc/api/classes/Object.html +0 -72
- data/doc/api/created.rid +0 -1
- data/doc/api/css/main.css +0 -263
- data/doc/api/css/panel.css +0 -383
- data/doc/api/css/reset.css +0 -53
- data/doc/api/favicon.ico +0 -0
- data/doc/api/files/CREDITS.html +0 -65
- data/doc/api/files/LICENSE.html +0 -76
- data/doc/api/files/lib/dfect/auto_rb.html +0 -80
- data/doc/api/files/lib/dfect/mini_rb.html +0 -77
- data/doc/api/files/lib/dfect/spec_rb.html +0 -73
- data/doc/api/files/lib/dfect/unit_rb.html +0 -73
- data/doc/api/files/lib/dfect_rb.html +0 -74
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/js/jquery-effect.js +0 -593
- data/doc/api/js/main.js +0 -22
- data/doc/api/js/searchdoc.js +0 -628
- data/doc/api/panel/index.html +0 -71
- data/doc/api/panel/search_index.js +0 -1
- data/doc/api/panel/tree.js +0 -1
- data/doc/history.erb +0 -161
- data/doc/intro.erb +0 -104
- data/doc/setup.erb +0 -107
- data/doc/usage.erb +0 -310
- data/rakefile +0 -21
data/lib/dfect/auto.rb
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# Simply require() this file and Dfect will be available for use anywhere
|
4
4
|
# in your program and will execute all tests before your program exits.
|
5
|
-
#--
|
6
|
-
# Copyright protects this work.
|
7
|
-
# See LICENSE file for details.
|
8
|
-
#++
|
9
5
|
|
10
6
|
require 'dfect'
|
11
7
|
|
@@ -17,8 +13,8 @@ at_exit do
|
|
17
13
|
Dfect.run
|
18
14
|
|
19
15
|
# reflect number of failures in exit status
|
20
|
-
stats = Dfect.report[:
|
21
|
-
fails = stats[:
|
16
|
+
stats = Dfect.report[:stats]
|
17
|
+
fails = stats[:fail] + stats[:error]
|
22
18
|
|
23
19
|
exit [fails, 255].min
|
24
20
|
end
|
data/lib/dfect/inochi.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Dfect
|
2
|
+
|
3
|
+
INSTDIR = File.expand_path('../../..', __FILE__)
|
4
|
+
|
5
|
+
# load inochi configuration
|
6
|
+
inochi_file = __FILE__.sub(/rb$/, 'yaml')
|
7
|
+
begin
|
8
|
+
|
9
|
+
configs = File.open(inochi_file) do |f|
|
10
|
+
require 'yaml'
|
11
|
+
YAML.load_stream(f).documents
|
12
|
+
end
|
13
|
+
|
14
|
+
INOCHI = configs.shift.to_hash
|
15
|
+
INOCHI[:runtime] ||= {}
|
16
|
+
INOCHI[:devtime] ||= {}
|
17
|
+
|
18
|
+
INOCHI2 = (configs.shift || {}).to_hash
|
19
|
+
|
20
|
+
rescue => error
|
21
|
+
error.message.insert 0,
|
22
|
+
"Could not load Inochi configuration file: #{inochi_file.inspect}\n"
|
23
|
+
raise error
|
24
|
+
end
|
25
|
+
|
26
|
+
# make values available as constants
|
27
|
+
INOCHI.each do |param, value|
|
28
|
+
const_set param.to_s.upcase, value
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.inspect
|
32
|
+
"#{PROJECT} #{VERSION} (#{RELEASE})"
|
33
|
+
end
|
34
|
+
|
35
|
+
# establish gem version dependencies
|
36
|
+
if respond_to? :gem
|
37
|
+
[:runtime, :devtime].each do |key|
|
38
|
+
INOCHI[key].each do |gem_name, gem_version|
|
39
|
+
begin
|
40
|
+
gem gem_name, *Array(gem_version)
|
41
|
+
rescue LoadError => error
|
42
|
+
warn "#{inspect} #{key}: #{error}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
--- # information about your project -----------------------------------------
|
2
|
+
|
3
|
+
# Name of your project.
|
4
|
+
:project: Dfect
|
5
|
+
|
6
|
+
# Name of your project when packaged as a directory.
|
7
|
+
:package: dfect
|
8
|
+
|
9
|
+
# Name of Ruby module that namespaces your project.
|
10
|
+
:library: Dfect
|
11
|
+
|
12
|
+
# A short, single-line description of your project.
|
13
|
+
:tagline: Assertion testing library for Ruby
|
14
|
+
|
15
|
+
# Address of your project's published website.
|
16
|
+
:website: http://snk.tuxfamily.org/lib/dfect/
|
17
|
+
|
18
|
+
# A list of the core developers of your project.
|
19
|
+
#
|
20
|
+
# :authors:
|
21
|
+
# - An Example <an@example.com> # with email
|
22
|
+
# - Another Example # without email
|
23
|
+
#
|
24
|
+
:authors:
|
25
|
+
- Suraj N. Kurapati <sunaku@gmail.com>
|
26
|
+
|
27
|
+
# Number of the current release of your project.
|
28
|
+
:version: 2.0.0
|
29
|
+
|
30
|
+
# Date of the current release of your project.
|
31
|
+
:release: 2010-03-21
|
32
|
+
|
33
|
+
# A list of gems required by your project during runtime.
|
34
|
+
#
|
35
|
+
# :runtime:
|
36
|
+
# # your project needs exactly version 1.2.3 of the "an_example" gem
|
37
|
+
# an_example: 1.2.3
|
38
|
+
#
|
39
|
+
# # your project needs at least version 1.2 (but not
|
40
|
+
# # version 1.2.4 or newer) of the "another_example" gem
|
41
|
+
# another_example: [ >= 1.2 , < 1.2.4 ]
|
42
|
+
#
|
43
|
+
# # your project needs any version of the "yet_another_example" gem
|
44
|
+
# yet_another_example:
|
45
|
+
#
|
46
|
+
:runtime:
|
47
|
+
|
48
|
+
# A list of gems required by your project during development.
|
49
|
+
#
|
50
|
+
# :devtime:
|
51
|
+
# # your project needs exactly version 1.2.3 of the "an_example" gem
|
52
|
+
# an_example: 1.2.3
|
53
|
+
#
|
54
|
+
# # your project needs at least version 1.2 (but not
|
55
|
+
# # version 1.2.4 or newer) of the "another_example" gem
|
56
|
+
# another_example: [ >= 1.2 , < 1.2.4 ]
|
57
|
+
#
|
58
|
+
# # your project needs any version of the "yet_another_example" gem
|
59
|
+
# yet_another_example:
|
60
|
+
#
|
61
|
+
:devtime:
|
62
|
+
|
63
|
+
--- # parameters for the `inochi` command ------------------------------------
|
64
|
+
|
65
|
+
# Location where project documentation will be uploaded by `inochi pub:doc`.
|
66
|
+
:pub_doc_target: ~/www/lib/dfect/
|
67
|
+
|
68
|
+
# Options for the `rsync` command used to upload your project's documentation.
|
69
|
+
:pub_doc_options: --verbose --compress --archive --update --delete
|
70
|
+
|
71
|
+
# Path to YAML file containing login information for publishing announcements.
|
72
|
+
:pub_ann_logins: ~/.config/inochi/pub_ann_logins.yaml
|
73
|
+
|
74
|
+
# Your project's unique identifier in the RAA (Ruby Application Archive).
|
75
|
+
:pub_ann_raa_id: dfect
|
data/lib/dfect/mini.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
# MiniTest emulation layer.
|
2
|
-
#--
|
3
|
-
# Copyright protects this work.
|
4
|
-
# See LICENSE file for details.
|
5
|
-
#++
|
6
2
|
|
7
3
|
require 'dfect'
|
8
4
|
require 'dfect/unit'
|
9
5
|
require 'dfect/spec'
|
10
6
|
|
11
|
-
module
|
7
|
+
module Dfect
|
12
8
|
instance_methods(false).each do |meth|
|
13
9
|
if meth =~ /^assert_not/
|
14
10
|
alias_method 'refute' + $', meth
|
data/lib/dfect/spec.rb
CHANGED
@@ -1,18 +1,11 @@
|
|
1
1
|
# RSpec emulation layer.
|
2
|
-
#--
|
3
|
-
# Copyright protects this work.
|
4
|
-
# See LICENSE file for details.
|
5
|
-
#++
|
6
2
|
|
7
3
|
require 'dfect'
|
8
4
|
|
9
|
-
module
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
alias context describe
|
15
|
-
alias it describe
|
5
|
+
module Dfect
|
6
|
+
alias describe D
|
7
|
+
alias context D
|
8
|
+
alias it D
|
16
9
|
|
17
10
|
def before what, &block
|
18
11
|
meth =
|
@@ -22,7 +15,7 @@ module Kernel
|
|
22
15
|
else raise ArgumentError, what
|
23
16
|
end
|
24
17
|
|
25
|
-
|
18
|
+
send meth, &block
|
26
19
|
end
|
27
20
|
|
28
21
|
def after what, &block
|
@@ -33,6 +26,6 @@ module Kernel
|
|
33
26
|
else raise ArgumentError, what
|
34
27
|
end
|
35
28
|
|
36
|
-
|
29
|
+
send meth, &block
|
37
30
|
end
|
38
31
|
end
|
data/lib/dfect/unit.rb
CHANGED
@@ -1,19 +1,12 @@
|
|
1
1
|
# Test::Unit emulation layer.
|
2
|
-
#--
|
3
|
-
# Copyright protects this work.
|
4
|
-
# See LICENSE file for details.
|
5
|
-
#++
|
6
2
|
|
7
3
|
require 'dfect'
|
8
4
|
|
9
|
-
module
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def teardown &block
|
15
|
-
Dfect.>(&block)
|
16
|
-
end
|
5
|
+
module Dfect
|
6
|
+
alias setup <
|
7
|
+
alias setup! <<
|
8
|
+
alias teardown >
|
9
|
+
alias teardown! >>
|
17
10
|
|
18
11
|
[
|
19
12
|
[:assert, nil, nil ],
|
@@ -26,29 +19,24 @@ module Kernel
|
|
26
19
|
# block parameters in define_method()
|
27
20
|
#
|
28
21
|
file, line = __FILE__, __LINE__ ; eval %{
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def #{prefix}_block message = nil, &block
|
34
|
-
Dfect.T#{polarity}(&block)
|
35
|
-
end
|
22
|
+
alias #{prefix} T#{polarity}
|
23
|
+
alias #{prefix} T#{polarity}
|
36
24
|
|
37
25
|
def #{prefix}_empty collection, message = nil
|
38
26
|
message ||= 'collection must #{action}be empty'
|
39
|
-
|
27
|
+
T#{polarity}(message) { collection.empty? }
|
40
28
|
end
|
41
29
|
|
42
30
|
def #{prefix}_equal expected, actual, message = nil
|
43
31
|
message ||= 'actual must #{action}equal expected'
|
44
|
-
|
32
|
+
T#{polarity}(message) { actual == expected }
|
45
33
|
end
|
46
34
|
|
47
35
|
def #{prefix}_in_delta expected, actual, delta = nil, message = nil
|
48
36
|
message ||= 'actual must #{action}be within delta of expected'
|
49
37
|
delta ||= 0.001
|
50
38
|
|
51
|
-
|
39
|
+
T#{polarity}(message) do
|
52
40
|
Math.abs(expected - actual) <= Math.abs(delta)
|
53
41
|
end
|
54
42
|
end
|
@@ -57,55 +45,55 @@ module Kernel
|
|
57
45
|
|
58
46
|
def #{prefix}_include item, collection, message = nil
|
59
47
|
message ||= 'collection must #{action}include item'
|
60
|
-
|
48
|
+
T#{polarity}(messsage) { collection.include? item }
|
61
49
|
end
|
62
50
|
|
63
51
|
def #{prefix}_instance_of _class, object, message = nil
|
64
52
|
message ||= 'object must #{action}be an instance of class'
|
65
|
-
|
53
|
+
T#{polarity}(message) { object.instance_of? _class }
|
66
54
|
end
|
67
55
|
|
68
56
|
def #{prefix}_kind_of _class, object, message = nil
|
69
57
|
message ||= 'object must #{action}be a kind of class'
|
70
|
-
|
58
|
+
T#{polarity}(message) { object.kind_of? _class }
|
71
59
|
end
|
72
60
|
|
73
61
|
def #{prefix}_nil object, message = nil
|
74
62
|
message ||= 'object must #{action}be nil'
|
75
|
-
|
63
|
+
T#{polarity}(message) { object == nil }
|
76
64
|
end
|
77
65
|
|
78
66
|
def #{prefix}_match pattern, string, message = nil
|
79
67
|
message ||= 'string must #{action}match pattern'
|
80
|
-
|
68
|
+
T#{polarity}(message) { string =~ pattern }
|
81
69
|
end
|
82
70
|
|
83
71
|
def #{prefix}_same expected, actual, message = nil
|
84
72
|
message ||= 'actual must #{action}be same as expected'
|
85
|
-
|
73
|
+
T#{polarity}(message) { actual.equal? expected }
|
86
74
|
end
|
87
75
|
|
88
76
|
def #{prefix}_operator object, operator, operand, message = nil
|
89
77
|
message ||= 'object must #{action}support operator with operand'
|
90
|
-
|
78
|
+
T#{polarity} { object.__send__ operator, operand }
|
91
79
|
end
|
92
80
|
|
93
81
|
def #{prefix}_raise *args, &block
|
94
|
-
|
82
|
+
E#{polarity}(args.pop, *args, &block)
|
95
83
|
end
|
96
84
|
|
97
85
|
def #{prefix}_respond_to object, query, message = nil
|
98
86
|
message ||= 'object must #{action}respond to query'
|
99
|
-
|
87
|
+
T#{polarity}(message) { object.respond_to? query }
|
100
88
|
end
|
101
89
|
|
102
90
|
def #{prefix}_throw symbol, message = nil, &block
|
103
|
-
|
91
|
+
C#{polarity}(message, symbol, &block)
|
104
92
|
end
|
105
93
|
|
106
94
|
def #{prefix}_send object, query, *args
|
107
95
|
response = object.__send__(query, *args)
|
108
|
-
|
96
|
+
T#{polarity} { response }
|
109
97
|
end
|
110
98
|
}, binding, file, line
|
111
99
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'dfect/inochi'
|
2
|
+
|
3
|
+
unless defined? Dfect::INOCHI
|
4
|
+
fail "Dfect module must be established by Inochi"
|
5
|
+
end
|
6
|
+
|
7
|
+
Dfect::INOCHI.each do |param, value|
|
8
|
+
const = param.to_s.upcase
|
9
|
+
|
10
|
+
unless Dfect.const_defined? const
|
11
|
+
fail "Dfect::#{const} must be established by Inochi"
|
12
|
+
end
|
13
|
+
|
14
|
+
unless Dfect.const_get(const) == value
|
15
|
+
fail "Dfect::#{const} is not what Inochi established"
|
16
|
+
end
|
17
|
+
end
|
@@ -1,10 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright protects this work.
|
3
|
-
# See LICENSE file for details.
|
4
|
-
#++
|
5
|
-
|
6
|
-
require 'dfect/auto'
|
7
|
-
|
8
1
|
D 'T()' do
|
9
2
|
T { true }
|
10
3
|
T { !false }
|
@@ -72,6 +65,7 @@ end
|
|
72
65
|
|
73
66
|
D 'E()' do
|
74
67
|
E(SyntaxError) { raise SyntaxError }
|
68
|
+
E(SyntaxError, 'must raise SyntaxError') { raise SyntaxError }
|
75
69
|
|
76
70
|
D 'forbids block to not raise anything' do
|
77
71
|
F { E? {} }
|
@@ -106,6 +100,7 @@ end
|
|
106
100
|
|
107
101
|
D 'E!()' do
|
108
102
|
E!(SyntaxError) { raise ArgumentError }
|
103
|
+
E!(SyntaxError, 'must not raise SyntaxError') { raise ArgumentError }
|
109
104
|
|
110
105
|
D 'allows block to not raise anything' do
|
111
106
|
E!(SyntaxError) {}
|
@@ -137,8 +132,16 @@ D 'E!()' do
|
|
137
132
|
end
|
138
133
|
end
|
139
134
|
|
135
|
+
D 'E?()' do
|
136
|
+
T E?(SyntaxError) { raise SyntaxError }
|
137
|
+
T E?(SyntaxError, 'must raise SyntaxError') { raise SyntaxError }
|
138
|
+
F E?(SyntaxError) { raise ArgumentError }
|
139
|
+
F E?(SyntaxError, 'must not raise SyntaxError') { raise ArgumentError }
|
140
|
+
end
|
141
|
+
|
140
142
|
D 'C()' do
|
141
143
|
C(:foo) { throw :foo }
|
144
|
+
C(:foo, 'must throw :foo') { throw :foo }
|
142
145
|
|
143
146
|
D 'forbids block to not throw anything' do
|
144
147
|
F { C?(:bar) {} }
|
@@ -168,6 +171,7 @@ end
|
|
168
171
|
|
169
172
|
D 'C!()' do
|
170
173
|
C!(:bar) { throw :foo }
|
174
|
+
C!(:bar, 'must not throw :bar') { throw :foo }
|
171
175
|
|
172
176
|
D 'allows block to not throw anything' do
|
173
177
|
C!(:bar) {}
|
@@ -196,6 +200,13 @@ D 'C!()' do
|
|
196
200
|
end
|
197
201
|
end
|
198
202
|
|
203
|
+
D 'C?()' do
|
204
|
+
T C?(:foo) { throw :foo }
|
205
|
+
T C?(:foo, 'must throw :foo') { throw :foo }
|
206
|
+
F C?(:bar) { throw :foo }
|
207
|
+
F C?(:bar, 'must not throw :bar') { throw :foo }
|
208
|
+
end
|
209
|
+
|
199
210
|
D 'D()' do
|
200
211
|
history = []
|
201
212
|
|
@@ -281,6 +292,155 @@ D 'YAML must be able to serialize a class' do
|
|
281
292
|
T { SyntaxError.to_yaml == "--- SyntaxError\n" }
|
282
293
|
end
|
283
294
|
|
295
|
+
D 'insulated root-level describe' do
|
296
|
+
@insulated = :insulated
|
297
|
+
non_closured = :non_closured
|
298
|
+
end
|
299
|
+
|
300
|
+
closured = :closured
|
301
|
+
|
302
|
+
D 'another insulated root-level describe' do
|
303
|
+
# without insulation, instance variables
|
304
|
+
# from previous root-level describe
|
305
|
+
# environments will spill into this one
|
306
|
+
F { defined? @insulated }
|
307
|
+
F { @insulated == :insulated }
|
308
|
+
|
309
|
+
# however, this insulation must
|
310
|
+
# not prevent closure access to
|
311
|
+
# surrounding local variables
|
312
|
+
T { defined? closured }
|
313
|
+
T { closured == :closured }
|
314
|
+
|
315
|
+
# except local variables defined
|
316
|
+
# within another insulated environment
|
317
|
+
F { defined? non_closured }
|
318
|
+
E(NameError) { non_closured }
|
319
|
+
|
320
|
+
@insulated_again = :insulated_again
|
321
|
+
|
322
|
+
D 'non-insulated nested describe' do
|
323
|
+
D 'inherits instance variables' do
|
324
|
+
T { defined? @insulated_again }
|
325
|
+
T { @insulated_again == :insulated_again }
|
326
|
+
end
|
327
|
+
|
328
|
+
D 'inherits instance methods' do
|
329
|
+
E!(NoMethodError) { instance_level_helper_method }
|
330
|
+
T { instance_level_helper_method == :instance_level_helper_method }
|
331
|
+
end
|
332
|
+
|
333
|
+
D 'inherits class methods' do
|
334
|
+
E!(NoMethodError) { self.class_level_helper_method }
|
335
|
+
T { self.class_level_helper_method == :class_level_helper_method }
|
336
|
+
|
337
|
+
E!(NoMethodError) { class_level_helper_method }
|
338
|
+
T { class_level_helper_method == self.class_level_helper_method }
|
339
|
+
end
|
340
|
+
|
341
|
+
@non_insulated_from_nested = :non_insulated_from_nested
|
342
|
+
end
|
343
|
+
|
344
|
+
D! 'nested but explicitly insulated describe' do
|
345
|
+
D 'does not inherit instance variables' do
|
346
|
+
F { defined? @insulated_again }
|
347
|
+
F { @insulated_again == :insulated_again }
|
348
|
+
end
|
349
|
+
|
350
|
+
D 'does not inherit instance methods' do
|
351
|
+
E(NameError) { instance_level_helper_method }
|
352
|
+
end
|
353
|
+
|
354
|
+
D 'does not inherit class methods' do
|
355
|
+
E(NoMethodError) { self.class_level_helper_method }
|
356
|
+
E(NameError) { class_level_helper_method }
|
357
|
+
end
|
358
|
+
|
359
|
+
@non_insulated_from_nested = 123
|
360
|
+
end
|
361
|
+
|
362
|
+
D 'another non-insulated nested describe' do
|
363
|
+
T { defined? @non_insulated_from_nested }
|
364
|
+
T { @non_insulated_from_nested == :non_insulated_from_nested }
|
365
|
+
end
|
366
|
+
|
367
|
+
def instance_level_helper_method
|
368
|
+
:instance_level_helper_method
|
369
|
+
end
|
370
|
+
|
371
|
+
def self.class_level_helper_method
|
372
|
+
:class_level_helper_method
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
D 'yet another insulated root-level describe' do
|
377
|
+
F { defined? @insulated_again }
|
378
|
+
F { @insulated_again == :insulated_again }
|
379
|
+
|
380
|
+
F { defined? @non_insulated_from_nested }
|
381
|
+
F { @non_insulated_from_nested == :non_insulated_from_nested }
|
382
|
+
end
|
383
|
+
|
384
|
+
S :knowledge do
|
385
|
+
@sharing_is_fun = :share_knowledge
|
386
|
+
end
|
387
|
+
|
388
|
+
S :money do
|
389
|
+
@sharing_is_fun = :share_money
|
390
|
+
end
|
391
|
+
|
392
|
+
D 'share knowledge' do
|
393
|
+
F { defined? @sharing_is_fun }
|
394
|
+
S :knowledge
|
395
|
+
T { defined? @sharing_is_fun }
|
396
|
+
T { @sharing_is_fun == :share_knowledge }
|
397
|
+
|
398
|
+
F { S? :power }
|
399
|
+
S! :power do
|
400
|
+
@sharing_is_fun = :share_power
|
401
|
+
end
|
402
|
+
T { S? :power }
|
403
|
+
end
|
404
|
+
|
405
|
+
D 'share money' do
|
406
|
+
F { defined? @sharing_is_fun }
|
407
|
+
S :money
|
408
|
+
T { defined? @sharing_is_fun }
|
409
|
+
T { @sharing_is_fun == :share_money }
|
410
|
+
|
411
|
+
S :power
|
412
|
+
T { defined? @sharing_is_fun }
|
413
|
+
T { @sharing_is_fun == :share_power }
|
414
|
+
|
415
|
+
D! 'share knowledge inside nested but explicitly insulated describe' do
|
416
|
+
F { defined? @sharing_is_fun }
|
417
|
+
S :knowledge
|
418
|
+
T { defined? @sharing_is_fun }
|
419
|
+
T { @sharing_is_fun == :share_knowledge }
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
D 're-sharing under a previously shared identifier' do
|
424
|
+
E ArgumentError, 'must raise an error' do
|
425
|
+
S :knowledge do
|
426
|
+
@sharing_is_fun = :overwrite_previous_share
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
F { defined? @sharing_is_fun }
|
431
|
+
F { @sharing_is_fun == :overwrite_previous_share }
|
432
|
+
end
|
433
|
+
|
434
|
+
D 'injecting an unshared code block' do
|
435
|
+
E ArgumentError, 'must raise an error' do
|
436
|
+
S :foobar
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
E 'injecting shared block outside of a test' do
|
441
|
+
S :knowledge
|
442
|
+
end
|
443
|
+
|
284
444
|
D 'stoping #run' do
|
285
445
|
Dfect.stop
|
286
446
|
raise 'this must not be reached!'
|