shared_should 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +32 -32
- data/VERSION +1 -1
- data/lib/shared_should.rb +25 -20
- data/shared_should.gemspec +1 -1
- data/test/test_shared_should.rb +61 -61
- data/test/test_shared_should_helper.rb +7 -7
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -16,25 +16,25 @@ Sharing shoulds is easy.
|
|
16
16
|
setup { @book = Book.new(:quantity => 1, :price => 10_00 }
|
17
17
|
|
18
18
|
### Define a shared should
|
19
|
-
|
19
|
+
share_should "be available for checkout" { assert @book.available_for_checkout? }
|
20
20
|
|
21
21
|
context "with a rentable book" do
|
22
22
|
setup { @book.rentable = true }
|
23
23
|
|
24
|
-
### Use the "available for checkout"
|
25
|
-
|
24
|
+
### Use the "be available for checkout" share_should
|
25
|
+
use_should "be available for checkout"
|
26
26
|
end
|
27
27
|
|
28
28
|
context "with a purchasable book" do
|
29
29
|
setup { @book.purchasable = true }
|
30
30
|
|
31
|
-
### Use the "available for checkout"
|
32
|
-
|
31
|
+
### Use the "be available for checkout" share_should in this context too
|
32
|
+
use_should "be available for checkout"
|
33
33
|
end
|
34
34
|
|
35
35
|
### ...or DRY it up by using .with or .when and an initialization block
|
36
|
-
|
37
|
-
|
36
|
+
use_should("be available for checkout").when("rentable") { @book.rentable = true }
|
37
|
+
use_should("be available for checkout").when("purchasable") { @book.purchasable = true }
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -44,11 +44,11 @@ Sharing setups is easy, too.
|
|
44
44
|
|
45
45
|
context "Book" do
|
46
46
|
### Define a shared setup
|
47
|
-
|
47
|
+
share_setup "for an in-stock book" { @book = Book.new(:quantity => 1, :price => 10_00) }
|
48
48
|
|
49
49
|
context "with an in-stock rentable book" do
|
50
50
|
### Use the shared setup here
|
51
|
-
|
51
|
+
use_setup "for an in-stock book"
|
52
52
|
|
53
53
|
### Do some additional setup after the shared setup
|
54
54
|
setup { @book.rentable = true }
|
@@ -58,7 +58,7 @@ Sharing setups is easy, too.
|
|
58
58
|
|
59
59
|
context "with an in-stock purchasable book" do
|
60
60
|
### Use the shared setup again
|
61
|
-
|
61
|
+
use_setup "for an in-stock book"
|
62
62
|
|
63
63
|
setup { @book.purchasable = true }
|
64
64
|
|
@@ -75,7 +75,7 @@ Sharing whole contexts? Schmeasy!
|
|
75
75
|
setup { @book = Book.new(:quantity => 1, :price => 10_00) }
|
76
76
|
|
77
77
|
### Define a shared context
|
78
|
-
|
78
|
+
share_context "for a book available for checkout" do
|
79
79
|
should "be in stock" { assert @book.quantity > 0 }
|
80
80
|
should "have a non-negative price" { assert @book.price > 0 }
|
81
81
|
should "be rentable or purchasable" { assert @book.rentable || @book.purchasable }
|
@@ -85,19 +85,19 @@ Sharing whole contexts? Schmeasy!
|
|
85
85
|
setup { @book.rentable = true }
|
86
86
|
|
87
87
|
### Run the shoulds inside the shared context with a rentable book
|
88
|
-
|
88
|
+
use_context "for a book available for checkout"
|
89
89
|
end
|
90
90
|
|
91
91
|
context "with a purchasable book" do
|
92
92
|
setup { @book.purchasable = true }
|
93
93
|
|
94
94
|
### Run the shoulds inside the shared context again with a purchasable book
|
95
|
-
|
95
|
+
use_context "for a book available for checkout"
|
96
96
|
end
|
97
97
|
|
98
98
|
### ...or DRY it up by using .with or .when and an initialization block
|
99
|
-
|
100
|
-
|
99
|
+
use_context("for a book available for checkout").when("rentable") { @book.rentable = true }
|
100
|
+
use_context("for a book available for checkout").when("purchasable") { @book.purchasable = true }
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -106,7 +106,7 @@ Sharing whole contexts? Schmeasy!
|
|
106
106
|
=== Finding Your Share
|
107
107
|
|
108
108
|
Some rules:
|
109
|
-
* When <tt>
|
109
|
+
* When <tt>use_should</tt>, <tt>use_context</tt> or <tt>use_setup</tt> is invoked, it searches up the context hierarchy to find a matching shared definition.
|
110
110
|
* You can redefine your shares by using the same name. These shares will only be available in in the current and descendant contexts.
|
111
111
|
* Shares defined at the root (on your TestCase) are available in all contexts.
|
112
112
|
* If you define a shared setup at the root level, you will need to call <tt>super</tt> if you have a setup instance method for your test.
|
@@ -118,15 +118,15 @@ The shared invocation accepts an initialization block by chaining <tt>when</tt>
|
|
118
118
|
context "Book" do
|
119
119
|
setup { @book = Book.new(:quantity => 1, :price => 10_00) }
|
120
120
|
|
121
|
-
|
121
|
+
share_should "be available for checkout" { assert @book.available_for_checkout? }
|
122
122
|
|
123
123
|
context "with a rentable book" do
|
124
|
-
# when
|
125
|
-
|
124
|
+
# when share_should "be available for checkout" is executed, @book will have rentable equal to true
|
125
|
+
use_should "be available for checkout".when("rentable") { @book.rentable = true }
|
126
126
|
end
|
127
127
|
|
128
128
|
context "with a purchasable book" do
|
129
|
-
|
129
|
+
use_should "be available for checkout".when("purchasable") { @book.purchasable = true }
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -135,13 +135,13 @@ The shared invocation accepts an initialization block by chaining <tt>when</tt>
|
|
135
135
|
Shared functions can also be parameterized using block parameters. This can be done for shared setups, shoulds, and the setups and shoulds contained within a shared context. The value passed to the declared shared function is the return value of the initialization block. The below example parameterizes a shared setup.
|
136
136
|
|
137
137
|
context "Book" do
|
138
|
-
|
138
|
+
share_setup "for an in-stock book" do |rentable|
|
139
139
|
@book = Book.new(:quantity => 1, :price => 10_00, :rentable => rentable, :purchasable => false)
|
140
140
|
end
|
141
141
|
|
142
142
|
context "with rentable book" do
|
143
143
|
# the return value of the block is "true" which will be passed as the block parameter "rentable"
|
144
|
-
|
144
|
+
use_setup("for an in-stock book").with("a rentable book") { true }
|
145
145
|
|
146
146
|
should "be available for checkout" { assert @book.available_for_checkout? }
|
147
147
|
end
|
@@ -153,13 +153,13 @@ Here is a parameterized shared should.
|
|
153
153
|
context "with in-stock book" do
|
154
154
|
setup { @book = Book.new(:quantity => 1) }
|
155
155
|
|
156
|
-
|
156
|
+
share_should "be unavailable for checkout for price" do |price|
|
157
157
|
@book.price = price
|
158
158
|
assert_false @book.available_for_checkout?
|
159
159
|
end
|
160
160
|
|
161
|
-
|
162
|
-
|
161
|
+
use_should("be unavailable for checkout for price").when("zero") { 0 }
|
162
|
+
use_should("be unavailable for checkout for price").when("negative") { -1 }
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -169,7 +169,7 @@ And a parameterized shared context.
|
|
169
169
|
context "with in-stock book" do
|
170
170
|
setup { @book = Book.new(:quantity => 1) }
|
171
171
|
|
172
|
-
|
172
|
+
share_context "for a book available for checkout at price" do
|
173
173
|
# parameters are on the setup and shoulds, not on the context
|
174
174
|
setup { |price| @book.price = price }
|
175
175
|
|
@@ -179,7 +179,7 @@ And a parameterized shared context.
|
|
179
179
|
should "be rentable or purchasable" { assert @book.rentable || @book.purchasable }
|
180
180
|
end
|
181
181
|
|
182
|
-
|
182
|
+
use_context("for a book available for checkout at price").when("positive") { 10_00 }
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -189,14 +189,14 @@ The shared functions also accept multiple parameters when the initialization blo
|
|
189
189
|
context "with rentable book" do
|
190
190
|
setup { @book = Book.new(:rentable => true) }
|
191
191
|
|
192
|
-
|
192
|
+
share_should "be unavailable for checkout for quantity and price" do |quantity, price|
|
193
193
|
@book.quantity = quantity
|
194
194
|
@book.price = price
|
195
195
|
assert_false @book.available_for_checkout?
|
196
196
|
end
|
197
197
|
|
198
|
-
|
199
|
-
|
198
|
+
use_should("be unavailable for checkout for quantity and price").when("zero quantity") { [0, 10_00] }
|
199
|
+
use_should("be unavailable for checkout for quantity and price").when("zero price") { [1, 0] }
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -207,7 +207,7 @@ The shared functions can also be re-usable across multiple test cases.
|
|
207
207
|
In your test helper file:
|
208
208
|
|
209
209
|
class Test::Unit::TestCase
|
210
|
-
|
210
|
+
share_setup "for an in-stock book" do |rentable, purchasable|
|
211
211
|
@book = Book.new(:quantity => 1, :price => 10_00, :rentable => rentable, :purchasable => purchasable)
|
212
212
|
end
|
213
213
|
end
|
@@ -216,7 +216,7 @@ In your test file:
|
|
216
216
|
|
217
217
|
class BookTest < Test::Unit::TestCase
|
218
218
|
context "with an in-stock book" do
|
219
|
-
|
219
|
+
share_setup "for an in-stock book".with { [true, true] }
|
220
220
|
|
221
221
|
should "be in stock" { assert @book.quantity > 0 }
|
222
222
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/shared_should.rb
CHANGED
@@ -99,25 +99,23 @@ module Shoulda::SharedContext
|
|
99
99
|
end
|
100
100
|
|
101
101
|
module SharedContextMethods
|
102
|
-
def shared_context_blocks
|
103
|
-
@shared_context_blocks ||= {}
|
104
|
-
end
|
105
|
-
|
106
|
-
def shared_setup_blocks
|
107
|
-
@shared_setup_blocks ||= {}
|
108
|
-
end
|
109
|
-
|
110
102
|
def shared_proxies
|
111
103
|
@shared_proxies ||= []
|
112
104
|
end
|
113
105
|
|
114
|
-
def
|
106
|
+
def use_should(shared_name)
|
115
107
|
shared_proxy = Shoulda::SharedProxy.new(shared_name)
|
116
108
|
shared_proxies << shared_proxy
|
117
109
|
return shared_proxy
|
118
110
|
end
|
119
|
-
|
120
|
-
def
|
111
|
+
|
112
|
+
def use_context(shared_name)
|
113
|
+
shared_proxy = Shoulda::SharedProxy.new(shared_name)
|
114
|
+
shared_proxies << shared_proxy
|
115
|
+
return shared_proxy
|
116
|
+
end
|
117
|
+
|
118
|
+
def use_setup(shared_name)
|
121
119
|
shared_proxy = Shoulda::SharedProxy.new(shared_name)
|
122
120
|
shared_setup_block = find_shared_setup_block(shared_name)
|
123
121
|
setup do
|
@@ -163,13 +161,14 @@ module Shoulda::SharedContext
|
|
163
161
|
end
|
164
162
|
end
|
165
163
|
|
164
|
+
# deprecated
|
166
165
|
def shared_context_should(shared_context_name, &shared_context_block)
|
167
|
-
|
166
|
+
share_context(shared_context_name, &shared_context_block)
|
168
167
|
end
|
169
168
|
|
170
|
-
def
|
169
|
+
def share_context(shared_context_name, &shared_context_block)
|
171
170
|
wrapping_shared_context_block = Proc.new do
|
172
|
-
context
|
171
|
+
context shared_context_name do
|
173
172
|
merge_block(&shared_context_block)
|
174
173
|
end
|
175
174
|
end
|
@@ -177,13 +176,14 @@ module Shoulda::SharedContext
|
|
177
176
|
do_shared_context(shared_context_name, shared_context_for_block(shared_context_block), &wrapping_shared_context_block)
|
178
177
|
end
|
179
178
|
|
179
|
+
# deprecated
|
180
180
|
def shared_should(shared_should_name, &shared_should_block)
|
181
|
-
|
181
|
+
share_should(shared_should_name, &shared_should_block)
|
182
182
|
end
|
183
183
|
|
184
|
-
def
|
184
|
+
def share_should(shared_should_name, &shared_should_block)
|
185
185
|
shared_context_block = Proc.new do
|
186
|
-
should
|
186
|
+
should shared_should_name do
|
187
187
|
call_block_with_shared_value(shared_should_block)
|
188
188
|
end
|
189
189
|
end
|
@@ -191,6 +191,7 @@ module Shoulda::SharedContext
|
|
191
191
|
do_shared_context(shared_should_name, shared_context_for_block(shared_should_block), &shared_context_block)
|
192
192
|
end
|
193
193
|
|
194
|
+
# deprecated
|
194
195
|
def shared_setup(shared_name, &setup_block)
|
195
196
|
shared_setup_block = Proc.new do
|
196
197
|
call_block_with_shared_value(setup_block)
|
@@ -199,7 +200,7 @@ module Shoulda::SharedContext
|
|
199
200
|
do_shared_setup(shared_name, shared_context_for_block(setup_block), &shared_setup_block)
|
200
201
|
end
|
201
202
|
|
202
|
-
def
|
203
|
+
def share_setup(shared_name, &setup_block)
|
203
204
|
current_context = eval('self', setup_block.binding)
|
204
205
|
Test::Unit::TestCase.shared_context_block_owner(current_context).shared_setup_blocks[shared_name] = setup_block
|
205
206
|
end
|
@@ -208,6 +209,10 @@ module Shoulda::SharedContext
|
|
208
209
|
@shared_context_blocks ||= {}
|
209
210
|
end
|
210
211
|
|
212
|
+
def shared_should_blocks
|
213
|
+
@shared_should_blocks ||= {}
|
214
|
+
end
|
215
|
+
|
211
216
|
def shared_setup_blocks
|
212
217
|
@shared_setup_blocks ||= {}
|
213
218
|
end
|
@@ -286,11 +291,11 @@ module Shoulda::SharedContext
|
|
286
291
|
if shared_setup_block = Test::Unit::TestCase.shared_context_block_owner(current_context).shared_setup_blocks[shared_name]
|
287
292
|
return shared_setup_block
|
288
293
|
end
|
289
|
-
raise "Unable to find
|
294
|
+
raise "Unable to find share_setup('#{shared_name}')" if current_context.kind_of?(Class)
|
290
295
|
break unless current_context.kind_of?(Shoulda::Context)
|
291
296
|
current_context = current_context.parent
|
292
297
|
end
|
293
|
-
raise "Unable to find
|
298
|
+
raise "Unable to find share_setup('#{shared_name}')"
|
294
299
|
end
|
295
300
|
end
|
296
301
|
end
|
data/shared_should.gemspec
CHANGED
data/test/test_shared_should.rb
CHANGED
@@ -11,9 +11,9 @@ class TestSharedShould < Test::Unit::TestCase
|
|
11
11
|
assert @setup_instance_method_executed
|
12
12
|
end
|
13
13
|
|
14
|
-
context ".
|
14
|
+
context ".share_context" do
|
15
15
|
context "without params" do
|
16
|
-
|
16
|
+
share_context "for a valid value" do
|
17
17
|
setup do
|
18
18
|
@context_value = true
|
19
19
|
end
|
@@ -32,11 +32,11 @@ class TestSharedShould < Test::Unit::TestCase
|
|
32
32
|
@value = true
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
use_context "for a valid value"
|
36
36
|
end
|
37
37
|
|
38
38
|
context "with value in initializer" do
|
39
|
-
|
39
|
+
use_context("for a valid value").when("a true value") { @value = true }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ class TestSharedShould < Test::Unit::TestCase
|
|
45
45
|
@value = true
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
share_context "for a valid specified value" do
|
49
49
|
setup do |value|
|
50
50
|
@expected_value = value
|
51
51
|
@context_value = true
|
@@ -64,10 +64,10 @@ class TestSharedShould < Test::Unit::TestCase
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
use_context("for a valid specified value").when("true") { true }
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
context ".shared_context_should" do
|
72
72
|
context "without params" do
|
73
73
|
setup do
|
@@ -119,9 +119,9 @@ class TestSharedShould < Test::Unit::TestCase
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
context ".
|
122
|
+
context ".share_should" do
|
123
123
|
context "without params" do
|
124
|
-
|
124
|
+
share_should "be a true value" do
|
125
125
|
assert @value
|
126
126
|
end
|
127
127
|
|
@@ -130,15 +130,15 @@ class TestSharedShould < Test::Unit::TestCase
|
|
130
130
|
@value = true
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
use_should "be a true value"
|
134
134
|
end
|
135
135
|
|
136
136
|
context "when value in initializer" do
|
137
|
-
|
137
|
+
use_should("be a true value").when("value is true") { @value = true }
|
138
138
|
end
|
139
139
|
|
140
140
|
context "with value in initializer" do
|
141
|
-
|
141
|
+
use_should("be a true value").with("true value") { @value = true }
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -147,11 +147,11 @@ class TestSharedShould < Test::Unit::TestCase
|
|
147
147
|
@value = true
|
148
148
|
end
|
149
149
|
|
150
|
-
|
150
|
+
share_should "be a valid specified value" do |value|
|
151
151
|
assert_equal value, @value
|
152
152
|
end
|
153
153
|
|
154
|
-
|
154
|
+
use_should("be a valid specified value").when("true") { true }
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
@@ -219,7 +219,7 @@ class TestSharedShould < Test::Unit::TestCase
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
-
context ".
|
222
|
+
context ".share_setup" do
|
223
223
|
context "without params" do
|
224
224
|
context "without initialization block" do
|
225
225
|
setup do
|
@@ -227,11 +227,11 @@ class TestSharedShould < Test::Unit::TestCase
|
|
227
227
|
@value = false
|
228
228
|
end
|
229
229
|
|
230
|
-
|
230
|
+
share_setup "for true value" do
|
231
231
|
@value = true
|
232
232
|
end
|
233
233
|
|
234
|
-
|
234
|
+
use_setup("for true value")
|
235
235
|
|
236
236
|
should "have a true value from shared setup" do
|
237
237
|
assert @value
|
@@ -244,11 +244,11 @@ class TestSharedShould < Test::Unit::TestCase
|
|
244
244
|
@value = false
|
245
245
|
end
|
246
246
|
|
247
|
-
|
247
|
+
share_setup "for value" do
|
248
248
|
@value = @initialization_value
|
249
249
|
end
|
250
250
|
|
251
|
-
|
251
|
+
use_setup("for value").with("true initialization value") { @initialization_value = true }
|
252
252
|
|
253
253
|
should "have a true value from shared setup" do
|
254
254
|
assert @value
|
@@ -257,7 +257,7 @@ class TestSharedShould < Test::Unit::TestCase
|
|
257
257
|
end
|
258
258
|
|
259
259
|
context "with parameterized initialization block" do
|
260
|
-
|
260
|
+
share_setup "for value" do |value|
|
261
261
|
@value = value
|
262
262
|
end
|
263
263
|
|
@@ -267,7 +267,7 @@ class TestSharedShould < Test::Unit::TestCase
|
|
267
267
|
@value = false
|
268
268
|
end
|
269
269
|
|
270
|
-
|
270
|
+
use_setup("for value").with("true initialization value") { true }
|
271
271
|
|
272
272
|
should "have a true value from shared setup" do
|
273
273
|
assert @value
|
@@ -319,47 +319,47 @@ class TestSharedShould < Test::Unit::TestCase
|
|
319
319
|
end
|
320
320
|
|
321
321
|
context "context directly under test class" do
|
322
|
-
|
322
|
+
share_setup "for a true value" do
|
323
323
|
@value = true
|
324
324
|
end
|
325
325
|
|
326
|
-
|
326
|
+
share_should "be a valid should test" do
|
327
327
|
assert @value
|
328
328
|
end
|
329
329
|
|
330
|
-
|
330
|
+
share_context "for a valid context test" do
|
331
331
|
should "have a true value" do
|
332
332
|
assert @value
|
333
333
|
end
|
334
334
|
end
|
335
|
-
|
336
|
-
|
335
|
+
|
336
|
+
use_setup "for a true value"
|
337
337
|
|
338
|
-
|
338
|
+
use_should "be a valid should test"
|
339
339
|
|
340
|
-
|
340
|
+
use_context "for a valid context test"
|
341
341
|
end
|
342
342
|
|
343
343
|
# test class as context
|
344
|
-
|
344
|
+
share_setup "for a true value in class" do
|
345
345
|
@class_value = true
|
346
346
|
end
|
347
347
|
|
348
|
-
|
348
|
+
share_should "be a valid should test in class" do
|
349
349
|
assert @class_value
|
350
350
|
end
|
351
351
|
|
352
|
-
|
352
|
+
share_context "for a valid context test in class" do
|
353
353
|
should "have a true value" do
|
354
354
|
assert @class_value
|
355
355
|
end
|
356
356
|
end
|
357
|
-
|
358
|
-
setup_for("a true value in class")
|
359
357
|
|
360
|
-
|
358
|
+
use_setup "for a true value in class"
|
359
|
+
|
360
|
+
use_should "be a valid should test in class"
|
361
361
|
|
362
|
-
|
362
|
+
use_context "for a valid context test in class"
|
363
363
|
|
364
364
|
|
365
365
|
# ensure should macros work
|
@@ -394,36 +394,36 @@ class TestSharedShould < Test::Unit::TestCase
|
|
394
394
|
|
395
395
|
# ensure test methods are created
|
396
396
|
expected_method_names = [
|
397
|
-
"test: .
|
398
|
-
"test: .
|
399
|
-
"test: .
|
400
|
-
"test: .
|
401
|
-
"test: .
|
402
|
-
"test: .
|
403
|
-
"test: .
|
404
|
-
"test: .
|
405
|
-
"test: .shared_context_should with params
|
406
|
-
"test: .shared_context_should with params
|
407
|
-
"test: .shared_context_should with params
|
408
|
-
"test: .shared_context_should without params
|
409
|
-
"test: .shared_context_should without params
|
397
|
+
"test: .share_context with params when true for a valid specified value should call setup in shared context. ",
|
398
|
+
"test: .share_context with params when true for a valid specified value should call setup in shared context. ",
|
399
|
+
"test: .share_context with params when true for a valid specified value should have specified value. ",
|
400
|
+
"test: .share_context with params when true for a valid specified value should setup @expected_value. ",
|
401
|
+
"test: .share_context without params with value in initializer when a true value for a valid value should call setup in shared context. ",
|
402
|
+
"test: .share_context without params with value in initializer when a true value for a valid value should have true value. ",
|
403
|
+
"test: .share_context without params with value in setup for a valid value should call setup in shared context. ",
|
404
|
+
"test: .share_context without params with value in setup for a valid value should have true value. ",
|
405
|
+
"test: .shared_context_should with params be valid for specified value should call setup in shared context. ",
|
406
|
+
"test: .shared_context_should with params be valid for specified value should have specified value. ",
|
407
|
+
"test: .shared_context_should with params be valid for specified value should setup @expected_value. ",
|
408
|
+
"test: .shared_context_should without params be valid should call setup in shared context. ",
|
409
|
+
"test: .shared_context_should without params be valid should have true value. ",
|
410
410
|
"test: .shared_setup with params with shared setup value should have a true value from shared setup. ",
|
411
411
|
"test: .shared_setup without params with shared setup value should have a true value from shared setup. ",
|
412
|
-
"test: .
|
413
|
-
"test: .
|
414
|
-
"test: .
|
415
|
-
"test: .shared_should with params should
|
416
|
-
"test: .shared_should without params should
|
417
|
-
"test: .
|
418
|
-
"test: .
|
419
|
-
"test: .
|
420
|
-
"test: .
|
412
|
+
"test: .share_setup with parameterized initialization block with shared setup value should have a true value from shared setup. ",
|
413
|
+
"test: .share_setup without params with initialization block should have a true value from shared setup. ",
|
414
|
+
"test: .share_setup without params without initialization block should have a true value from shared setup. ",
|
415
|
+
"test: .shared_should with params should have specified value. ",
|
416
|
+
"test: .shared_should without params should have true value. ",
|
417
|
+
"test: .share_should with params when true should be a valid specified value. ",
|
418
|
+
"test: .share_should without params when value in initializer when value is true should be a true value. ",
|
419
|
+
"test: .share_should without params with value in initializer with true value should be a true value. ",
|
420
|
+
"test: .share_should without params with value in setup should be a true value. ",
|
421
421
|
"test: context directly under test class for a valid context test should have a true value. ",
|
422
422
|
"test: context directly under test class should be a valid should test. ",
|
423
|
-
"test: parameterized block with an array
|
424
|
-
"test: parameterized block with an array
|
425
|
-
"test: parameterized block with an array
|
426
|
-
"test: parameterized block with an array should be
|
423
|
+
"test: parameterized block with an array be valid with shared context should do something with shared_value. ",
|
424
|
+
"test: parameterized block with an array be valid with shared context should do something with value block param. ",
|
425
|
+
"test: parameterized block with an array be valid with shared context should do something with value block params. ",
|
426
|
+
"test: parameterized block with an array should be valid with shared should. ",
|
427
427
|
"test: should be a valid should test in class. ",
|
428
428
|
"test: for a valid context test in class should have a true value. ",
|
429
429
|
"test: SharedShould should execute setup instance method. ",
|
@@ -6,7 +6,7 @@ class SubclassTestCase < Test::Unit::TestCase
|
|
6
6
|
assert @value
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
share_should "be a true value for shared should helper" do
|
10
10
|
assert @value
|
11
11
|
end
|
12
12
|
|
@@ -23,7 +23,7 @@ class Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
share_context "for a true value for shared context helper" do
|
27
27
|
should "be true value" do
|
28
28
|
assert @value
|
29
29
|
end
|
@@ -33,7 +33,7 @@ class Test::Unit::TestCase
|
|
33
33
|
@value = true
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
share_setup "for a true value for shared setup helper" do
|
37
37
|
@value = true
|
38
38
|
end
|
39
39
|
end
|
@@ -47,7 +47,7 @@ class TestSharedShouldHelper < SubclassTestCase
|
|
47
47
|
|
48
48
|
should_have_true_value_for_shared_should_helper
|
49
49
|
|
50
|
-
|
50
|
+
use_should "be a true value for shared should helper"
|
51
51
|
end
|
52
52
|
|
53
53
|
context "with shared context helper" do
|
@@ -57,7 +57,7 @@ class TestSharedShouldHelper < SubclassTestCase
|
|
57
57
|
|
58
58
|
should_be_valid_for_shared_context_helper
|
59
59
|
|
60
|
-
|
60
|
+
use_context "for a true value for shared context helper"
|
61
61
|
end
|
62
62
|
|
63
63
|
context "with shared_setup helper" do
|
@@ -68,8 +68,8 @@ class TestSharedShouldHelper < SubclassTestCase
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
context "with
|
72
|
-
|
71
|
+
context "with share_setup helper" do
|
72
|
+
use_setup "for a true value for shared setup helper"
|
73
73
|
|
74
74
|
should "be true value" do
|
75
75
|
assert @value
|