spec/support/spec_perimeter.rb in kindergarten-0.1.0 vs spec/support/spec_perimeter.rb in kindergarten-0.1.1
- old
+ new
@@ -5,10 +5,15 @@
govern do
can :view, String
end
+ subscribe :eating, :eat, :evented
+ subscribe :puppets, :play, lambda { |event, purpose|
+ purpose.sandbox.testing.dress!
+ }
+
# should pass and return the child
def sandboxed
guard(:view, child)
end
@@ -31,7 +36,28 @@
# should raise Unguarded
def unsafe
return child.reverse
end
- sandbox :sandboxed, :not_guarded, :guarded, :unsafe
+ # happens on dining.eat event
+ def evented
+ @evented = true
+ end
+
+ def evented?
+ @evented == true ? true : false
+ end
+
+ expose :dress!
+ def dress!
+ unguarded
+ @dressed = true
+ end
+
+ def puppet_dressed?
+ unguarded
+ @dressed == true ? true : false
+ end
+
+ sandbox :sandboxed, :not_guarded, :guarded, :unsafe, :evented
+ expose :puppet_dressed?
end