Sha256: 63c6c9c59035d9ca017bdfaddc75459b0e9334935e96d6ebd69e205df610b7f8

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

require 'simplecov'
require 'minitest/autorun'
require 'coveralls'

if ENV['COVERALLS']
  Coveralls.wear!
end

require 'surrounded'
require 'surrounded/context'

class User
  include Surrounded
  def initialize(name)
    @name = name
  end
  attr_reader :name
end

class TestContext
  extend Surrounded::Context

  initialize(:user, :other_user)

  trigger :access_other_object do
    user.other_user.name
  end

  def block_method(*args, &block)
    block.call(*args, self)
  end
  trigger :block_method

  def regular_method_trigger
    true
  end
  trigger :regular_method_trigger
end

# This is a different implementation of module_method_rebinding?
# created in order to check that the behavior of the code is correct.
#
# This method is used in tests and module_method_rebinding? is used
# in the library code.
def test_rebinding_methods?
  unbound = Enumerable.instance_method(:count)
  unbound.bind(Object.new)
  true
rescue TypeError
  false
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surrounded-0.8.4 test/test_helper.rb