Sha256: ce9a1949be4dfc8883c3d0a7b1a045ea10f84381a3a113a8b02fbe9548cfdb78

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require 'test_helper'

# If you want to use wrappers, here's how you could
require 'delegate'
class WrapperContext
  extend Surrounded::Context

  apply_roles_on(:trigger)
  setup(:admin, :task)

  class Admin < SimpleDelegator
    include Surrounded
    def some_admin_method
      'hello from the admin wrapper!'
    end
  end

  trigger :do_something do
    admin.some_admin_method
  end
end

describe WrapperContext do
  let(:context){
    WrapperContext.new(Object.new, Object.new)
  }
  it 'wraps objects and allows them to respond to new methods' do
    assert_equal 'hello from the admin wrapper!', context.do_something
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surrounded-0.2.0 test/example_wrapper_test.rb