diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-27 13:12:39 +0000 |
commit | 42921458ff7eacd1ef614c3e67596c75ccd0a1d4 (patch) | |
tree | 710c40988e51715f84a12c3295162b1c5697bf51 /spec/ruby/core/symbol/to_proc_spec.rb | |
parent | a53ee2136ff59ebc54ae6c98a500765bc3d13d44 (diff) | |
download | ruby-42921458ff7eacd1ef614c3e67596c75ccd0a1d4.tar.gz |
Update to ruby/spec@e57f49c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/symbol/to_proc_spec.rb')
-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 |