File: spec_helper.rb

package info (click to toggle)
ruby-cliver 0.3.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 208 kB
  • sloc: ruby: 760; makefile: 3
file content (16 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# encoding: utf-8

# 1.8.x doesn't support public_send and we use it in spec,
# so we emulate it in this monkeypatch.
class Object
  def public_send(method, *args, &block)
    case method.to_s
    when *private_methods
      raise NoMethodError, "private method `#{method}' called for #{self}"
    when *protected_methods
      raise NoMethodError, "protected method `#{method}' called for #{self}"
    else
      send(method, *args, &block)
    end
  end unless method_defined?(:public_send)
end