test/context_forwarding_test.rb in surrounded-0.9.3 vs test/context_forwarding_test.rb in surrounded-0.9.4

- old
+ new

@@ -5,10 +5,12 @@ initialize :one, :two forwarding [:hello, :goodbye] => :one forward_trigger :two, :ping + forward_trigger :two, :argumentative + forwards :two, :blockhead role :one do def hello 'hello' end @@ -20,10 +22,18 @@ role :two do def ping one.hello end + + def argumentative(yes, no) + [yes, no].join(' and ') + end + + def blockhead + yield + end end end describe Surrounded::Context, 'forwarding triggers' do let(:user){ User.new("Jim") } @@ -53,7 +63,18 @@ Sending.class_eval do forward_trigger :one, :__send__ end } assert_match(/you may not forward '__send__/i, error.message) + end + + it 'passes arguments' do + assert_equal 'YES and NO', context.argumentative('YES','NO') + end + + it 'passes blocks' do + result = context.blockhead do + "Put them in the iron maiden. Excellent!" + end + assert_equal "Put them in the iron maiden. Excellent!", result end end \ No newline at end of file