diff options
| author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
| commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
| tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/struct/new_spec.rb | |
| parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) | |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/struct/new_spec.rb')
| -rw-r--r-- | spec/ruby/core/struct/new_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/ruby/core/struct/new_spec.rb b/spec/ruby/core/struct/new_spec.rb index 01231e85fb..f888106950 100644 --- a/spec/ruby/core/struct/new_spec.rb +++ b/spec/ruby/core/struct/new_spec.rb @@ -13,7 +13,7 @@ describe "Struct.new" do first.should == Struct::Person second = nil - lambda { + -> { second = Struct.new('Person', :hair, :sex) }.should complain(/redefining constant/) second.should == Struct::Person @@ -49,35 +49,35 @@ describe "Struct.new" do it "fails with invalid constant name as first argument" do - lambda { Struct.new('animal', :name, :legs, :eyeballs) }.should raise_error(NameError) + -> { Struct.new('animal', :name, :legs, :eyeballs) }.should raise_error(NameError) end it "raises a TypeError if object doesn't respond to to_sym" do - lambda { Struct.new(:animal, mock('giraffe')) }.should raise_error(TypeError) - lambda { Struct.new(:animal, 1.0) }.should raise_error(TypeError) - lambda { Struct.new(:animal, Time.now) }.should raise_error(TypeError) - lambda { Struct.new(:animal, Class) }.should raise_error(TypeError) - lambda { Struct.new(:animal, nil) }.should raise_error(TypeError) - lambda { Struct.new(:animal, true) }.should raise_error(TypeError) - lambda { Struct.new(:animal, ['chris', 'evan']) }.should raise_error(TypeError) + -> { Struct.new(:animal, mock('giraffe')) }.should raise_error(TypeError) + -> { Struct.new(:animal, 1.0) }.should raise_error(TypeError) + -> { Struct.new(:animal, Time.now) }.should raise_error(TypeError) + -> { Struct.new(:animal, Class) }.should raise_error(TypeError) + -> { Struct.new(:animal, nil) }.should raise_error(TypeError) + -> { Struct.new(:animal, true) }.should raise_error(TypeError) + -> { Struct.new(:animal, ['chris', 'evan']) }.should raise_error(TypeError) end ruby_version_is ""..."2.5" do it "raises a TypeError if an argument is a Hash" do - lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError) + -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError) end end ruby_version_is "2.5" do it "raises a ArgumentError if passed a Hash with an unknown key" do - lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError) + -> { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError) end end it "raises a TypeError if object is not a Symbol" do obj = mock(':ruby') def obj.to_sym() :ruby end - lambda { Struct.new(:animal, obj) }.should raise_error(TypeError) + -> { Struct.new(:animal, obj) }.should raise_error(TypeError) end it "processes passed block with instance_eval" do @@ -128,7 +128,7 @@ describe "Struct.new" do end it "fails with too many arguments" do - lambda { StructClasses::Ruby.new('2.0', 'i686', true) }.should raise_error(ArgumentError) + -> { StructClasses::Ruby.new('2.0', 'i686', true) }.should raise_error(ArgumentError) end it "passes a hash as a normal argument" do |
