diff options
Diffstat (limited to 'spec/ruby/core/symbol')
-rw-r--r-- | spec/ruby/core/symbol/to_proc_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/ruby/core/symbol/to_proc_spec.rb b/spec/ruby/core/symbol/to_proc_spec.rb index 8cf00b085f..65f6e27be4 100644 --- a/spec/ruby/core/symbol/to_proc_spec.rb +++ b/spec/ruby/core/symbol/to_proc_spec.rb @@ -12,19 +12,22 @@ describe "Symbol#to_proc" do :to_s.to_proc.call(obj).should == "Received #to_s" end + it "produces a proc with arity -1" do + pr = :to_s.to_proc + pr.arity.should == -1 + end + it "raises an ArgumentError when calling #call on the Proc without receiver" do - lambda { :object_id.to_proc.call }.should raise_error(ArgumentError) + lambda { :object_id.to_proc.call }.should raise_error(ArgumentError, "no receiver given") end it "produces a proc that always returns [[:rest]] for #parameters" do pr = :to_s.to_proc pr.parameters.should == [[:rest]] end -end -describe "Symbol#to_proc" do - before :all do - @klass = Class.new do + it "passes along the block passed to Proc#call" do + klass = Class.new do def m yield end @@ -33,9 +36,6 @@ describe "Symbol#to_proc" do :m.to_proc.call(self) { :value } end end - end - - it "passes along the block passed to Proc#call" do - @klass.new.to_proc.should == :value + klass.new.to_proc.should == :value end end |