Sha256: bb6c91e207f0ce6a1cfc11ef248878a1abd63a2a360f1dc1a2986efc20710af5

Contents?: true

Size: 624 Bytes

Versions: 11

Compression:

Stored size: 624 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.new('jim'), Object.new)
  }
  it 'wraps objects using DelegateClass' do
    assert_equal 'hello from the admin DelegateClass wrapper!', context.do_something
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
surrounded-0.9.11 test/example_delegate_class_test.rb
surrounded-0.9.10 test/example_delegate_class_test.rb
surrounded-0.9.9 test/example_delegate_class_test.rb
surrounded-0.9.8 test/example_delegate_class_test.rb
surrounded-0.9.7 test/example_delegate_class_test.rb
surrounded-0.9.6 test/example_delegate_class_test.rb
surrounded-0.9.5 test/example_delegate_class_test.rb
surrounded-0.9.4 test/example_delegate_class_test.rb
surrounded-0.9.3 test/example_delegate_class_test.rb
surrounded-0.9.2 test/example_delegate_class_test.rb
surrounded-0.9.1 test/example_delegate_class_test.rb