Sha256: e0505de530df1c8758631a32f2206a4bdaf3722fa498ef6d870844f4fc78b300
Contents?: true
Size: 636 Bytes
Versions: 2
Compression:
Stored size: 636 Bytes
Contents
require 'test_helper' # If you want to use wrappers, here's how you could class DelegateClassContext extend Surrounded::Context initialize(:user, :task) delegate_class :user, 'User' do def some_admin_method 'hello from the admin DelegateClass wrapper!' end end wrap :task do end trigger :do_something do user.some_admin_method end end describe DelegateClassContext do let(:context){ DelegateClassContext.new(user: User.new('jim'), task: Object.new) } it 'wraps objects using DelegateClass' do assert_equal 'hello from the admin DelegateClass wrapper!', context.do_something end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
surrounded-1.1.0 | test/example_delegate_class_test.rb |
surrounded-1.0.0 | test/example_delegate_class_test.rb |