ratnikov-shoulda 2.9.0.1 → 2.9.0.2
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.
- data/lib/shoulda/context.rb +3 -3
- data/test/other/helpers_test.rb +2 -2
- data/test/other/should_test.rb +11 -6
- metadata +1 -1
data/lib/shoulda/context.rb
CHANGED
|
@@ -257,10 +257,10 @@ module Shoulda
|
|
|
257
257
|
context = self
|
|
258
258
|
test_unit_class.send(:define_method, test_name) do
|
|
259
259
|
begin
|
|
260
|
-
|
|
260
|
+
context.run_all_setup_blocks(self)
|
|
261
|
+
context.run_parent_evaluate_blocks(self)
|
|
261
262
|
should[:before].bind(self).call if should[:before]
|
|
262
|
-
|
|
263
|
-
context.run_all_evaluate_blocks(self)
|
|
263
|
+
context.run_current_evaluate_blocks(self)
|
|
264
264
|
should[:block].bind(self).call
|
|
265
265
|
ensure
|
|
266
266
|
context.run_all_teardown_blocks(self)
|
data/test/other/helpers_test.rb
CHANGED
|
@@ -84,7 +84,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
context "after adding another value" do
|
|
87
|
-
|
|
87
|
+
evaluate do
|
|
88
88
|
@a.push(4)
|
|
89
89
|
end
|
|
90
90
|
|
|
@@ -96,7 +96,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
context "after replacing it with an array of strings" do
|
|
99
|
-
|
|
99
|
+
evaluate do
|
|
100
100
|
@a = %w(a b c d e f)
|
|
101
101
|
end
|
|
102
102
|
|
data/test/other/should_test.rb
CHANGED
|
@@ -227,22 +227,27 @@ class ShouldTest < Test::Unit::TestCase # :nodoc:
|
|
|
227
227
|
|
|
228
228
|
context "A :before proc" do
|
|
229
229
|
setup do
|
|
230
|
-
|
|
230
|
+
assert_nil @value, "Should not have run the before block before the setup"
|
|
231
231
|
@value = "setup"
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
assert_equal "
|
|
234
|
+
evaluate do
|
|
235
|
+
assert_equal "before", @value
|
|
236
|
+
@value = "evaluate"
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
should "run after the current setup and before the current evaluate", :before => lambda { @value = "before" } do
|
|
240
|
+
assert_equal "evaluate", @value
|
|
236
241
|
end
|
|
237
242
|
end
|
|
238
243
|
|
|
239
244
|
context "a before statement" do
|
|
240
|
-
|
|
245
|
+
evaluate do
|
|
241
246
|
assert_equal "before", @value
|
|
242
|
-
@value = "
|
|
247
|
+
@value = "evaluate"
|
|
243
248
|
end
|
|
244
249
|
|
|
245
|
-
before_should "run before the current
|
|
250
|
+
before_should "run before the current evaluate" do
|
|
246
251
|
@value = "before"
|
|
247
252
|
end
|
|
248
253
|
end
|