Sha256: 7e1b877c931a71c8840c1480398e71ac7fd6cdc2216b7eab14bd4f45ec2071b2

Contents?: true

Size: 585 Bytes

Versions: 16

Compression:

Stored size: 585 Bytes

Contents

require 'test_helper'

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

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

  wrap :admin do
    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

16 entries across 16 versions & 1 rubygems

Version Path
surrounded-0.8.3 test/example_wrapper_test.rb
surrounded-0.8.2 test/example_wrapper_test.rb
surrounded-0.8.1 test/example_wrapper_test.rb
surrounded-0.8.0 test/example_wrapper_test.rb
surrounded-0.7.3 test/example_wrapper_test.rb
surrounded-0.7.2 test/example_wrapper_test.rb
surrounded-0.7.1 test/example_wrapper_test.rb
surrounded-0.7.0 test/example_wrapper_test.rb
surrounded-0.6.0 test/example_wrapper_test.rb
surrounded-0.5.1 test/example_wrapper_test.rb
surrounded-0.5.0 test/example_wrapper_test.rb
surrounded-0.4.1 test/example_wrapper_test.rb
surrounded-0.4.0 test/example_wrapper_test.rb
surrounded-0.3.1 test/example_wrapper_test.rb
surrounded-0.3.0 test/example_wrapper_test.rb
surrounded-0.2.1 test/example_wrapper_test.rb