From: Phlip Date: 2007-11-10T12:55:09+09:00 Subject: Snippet - assert_yin_yang 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! -- Phlip http://c2.com/cgi/wiki?PhlIp