File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 12
12
:to_s . to_proc . call ( obj ) . should == "Received #to_s"
13
13
end
14
14
15
+ it "produces a proc with arity -1" do
16
+ pr = :to_s . to_proc
17
+ pr . arity . should == -1
18
+ end
19
+
15
20
it "raises an ArgumentError when calling #call on the Proc without receiver" do
16
- lambda { :object_id . to_proc . call } . should raise_error ( ArgumentError )
21
+ lambda { :object_id . to_proc . call } . should raise_error ( ArgumentError , "no receiver given" )
17
22
end
18
23
19
24
it "produces a proc that always returns [[:rest]] for #parameters" do
20
25
pr = :to_s . to_proc
21
26
pr . parameters . should == [ [ :rest ] ]
22
27
end
23
- end
24
28
25
- describe "Symbol#to_proc" do
26
- before :all do
27
- @klass = Class . new do
29
+ it "passes along the block passed to Proc#call" do
30
+ klass = Class . new do
28
31
def m
29
32
yield
30
33
end
@@ -33,9 +36,6 @@ def to_proc
33
36
:m . to_proc . call ( self ) { :value }
34
37
end
35
38
end
36
- end
37
-
38
- it "passes along the block passed to Proc#call" do
39
- @klass . new . to_proc . should == :value
39
+ klass . new . to_proc . should == :value
40
40
end
41
41
end
You can’t perform that action at this time.
0 commit comments