Rubies:
This is a Rails assertion, but any project could use its concept.
It asserts that a Model value is one state before a block, and another
state after:
def assert_yin_yang(object, method, yin, yang, diagnostic = nil)
message = build_message(diagnostic, “<?>#<?>”, object, method)
assert_equal yin, object.send(method), message
yield
object.reload
assert_equal yang, object.send(method), message
end
Detect something switched from false to true like this:
helmet = shrew.accessories.first
assert_yin_yang helmet, :active, false, true do
post :use, :id => helmet.id
end
Any tips welcome regarding making this more yin-yang-ey!