module Shoulda::ActionController::Macros
def should_set_session(key, &block)
should_set_session(:user_id) { @user.id }
Example:
that returns the expected value.
session is correct. Expects the session key as a parameter, and a block
Macro that creates a test asserting that a value returned from the
def should_set_session(key, &block) matcher = set_session(key) should matcher.description do expected_value = instance_eval(&block) matcher = matcher.to(expected_value) assert_accepts matcher, @controller end end