Sha256: 4c1a1516ac5f88fc72b2fcb20b220ebd0a1ae127dc3f7766566659202939e119
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'test_helper' class Sending extend Surrounded::Context initialize :one, :two forwarding [:hello, :goodbye] => :one forward_trigger :two, :ping role :one do def hello 'hello' end def goodbye 'goodbye' end end role :two do def ping one.hello end end end describe Surrounded::Context, 'forwarding triggers' do let(:user){ User.new("Jim") } let(:other_user){ User.new("Guille") } let(:context){ Sending.new(user, other_user) } it 'forwards multiple configured instance methods as triggers' do assert_equal 'hello', context.hello assert_equal 'goodbye', context.goodbye end it 'forwards individual configured instance methods as triggers' do assert_equal 'hello', context.ping end it 'does not forward __id__' do error = assert_raises(ArgumentError){ Sending.class_eval do forward_trigger :one, :__id__ end } assert_match(/you may not forward '__id__`/i, error.message) end it 'does not forward __send__' do error = assert_raises(ArgumentError){ Sending.class_eval do forward_trigger :one, :__send__ end } assert_match(/you may not forward '__send__/i, error.message) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
surrounded-0.9.3 | test/context_forwarding_test.rb |
surrounded-0.9.2 | test/context_forwarding_test.rb |
surrounded-0.9.1 | test/context_forwarding_test.rb |