summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/shared/compose.rb
blob: 3d3f3b310d46994888d34b8d688c07097f29c76e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
describe :proc_compose, shared: true do
  it "raises TypeError if passed not callable object" do
    lhs = @object.call
    not_callable = Object.new

    -> {
      lhs.send(@method, not_callable)
    }.should raise_error(TypeError, "callable object is expected")

  end

  it "does not try to coerce argument with #to_proc" do
    lhs = @object.call

    succ = Object.new
    def succ.to_proc(s); s.succ; end

    -> {
      lhs.send(@method, succ)
    }.should raise_error(TypeError, "callable object is expected")
  end
end