Sha256: 866830c3d47521916fd189cfcaf8aee56d6628aeb436efd28ab15a48f267009b

Contents?: true

Size: 579 Bytes

Versions: 13

Compression:

Stored size: 579 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(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

13 entries across 13 versions & 1 rubygems

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