Sha256: db60350b00fc442fc9060d981ae58be163ae559a139c8f005d263b0e1f3b64c2

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

require 'test_helper'

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

  initialize(:admin, :task)

  wrap :admin do
    def some_admin_method
      'hello from the admin wrapper!'
    end
  end
  wrap :task do; end

  trigger :do_something do
    admin.some_admin_method
  end
end

describe WrapperContext do
  let(:context){
    WrapperContext.new(admin: Object.new, task: 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

2 entries across 2 versions & 1 rubygems

Version Path
surrounded-1.1.0 test/example_wrapper_test.rb
surrounded-1.0.0 test/example_wrapper_test.rb