diff options
author | Benoit Daloze <[email protected]> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/struct | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/struct')
-rw-r--r-- | spec/ruby/core/struct/dig_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/struct/element_reference_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/struct/element_set_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/struct/new_spec.rb | 26 | ||||
-rw-r--r-- | spec/ruby/core/struct/struct_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/struct/values_at_spec.rb | 2 |
6 files changed, 27 insertions, 27 deletions
diff --git a/spec/ruby/core/struct/dig_spec.rb b/spec/ruby/core/struct/dig_spec.rb index c7c979fabe..4e39e5a4ef 100644 --- a/spec/ruby/core/struct/dig_spec.rb +++ b/spec/ruby/core/struct/dig_spec.rb @@ -20,13 +20,13 @@ describe "Struct#dig" do it "raises a TypeError if any intermediate step does not respond to #dig" do instance = @klass.new(1) - lambda { + -> { instance.dig(:a, 3) }.should raise_error(TypeError) end it "raises an ArgumentError if no arguments provided" do - lambda { @instance.dig }.should raise_error(ArgumentError) + -> { @instance.dig }.should raise_error(ArgumentError) end it "calls #dig on any intermediate step with the rest of the sequence as arguments" do diff --git a/spec/ruby/core/struct/element_reference_spec.rb b/spec/ruby/core/struct/element_reference_spec.rb index 28706a65aa..0f6d547f66 100644 --- a/spec/ruby/core/struct/element_reference_spec.rb +++ b/spec/ruby/core/struct/element_reference_spec.rb @@ -26,20 +26,20 @@ describe "Struct#[]" do it "fails when it does not know about the requested attribute" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car[3] }.should raise_error(IndexError) - lambda { car[-4] }.should raise_error(IndexError) - lambda { car[:body] }.should raise_error(NameError) - lambda { car['wheels'] }.should raise_error(NameError) + -> { car[3] }.should raise_error(IndexError) + -> { car[-4] }.should raise_error(IndexError) + -> { car[:body] }.should raise_error(NameError) + -> { car['wheels'] }.should raise_error(NameError) end it "fails if passed too many arguments" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car[:make, :model] }.should raise_error(ArgumentError) + -> { car[:make, :model] }.should raise_error(ArgumentError) end it "fails if not passed a string, symbol, or integer" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car[Object.new] }.should raise_error(TypeError) + -> { car[Object.new] }.should raise_error(TypeError) end it "returns attribute names that contain hyphens" do diff --git a/spec/ruby/core/struct/element_set_spec.rb b/spec/ruby/core/struct/element_set_spec.rb index 246e7cf3c2..6ba7b081a9 100644 --- a/spec/ruby/core/struct/element_set_spec.rb +++ b/spec/ruby/core/struct/element_set_spec.rb @@ -21,9 +21,9 @@ describe "Struct#[]=" do it "fails when trying to assign attributes which don't exist" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car[:something] = true }.should raise_error(NameError) - lambda { car[3] = true }.should raise_error(IndexError) - lambda { car[-4] = true }.should raise_error(IndexError) - lambda { car[Object.new] = true }.should raise_error(TypeError) + -> { car[:something] = true }.should raise_error(NameError) + -> { car[3] = true }.should raise_error(IndexError) + -> { car[-4] = true }.should raise_error(IndexError) + -> { car[Object.new] = true }.should raise_error(TypeError) end end 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 diff --git a/spec/ruby/core/struct/struct_spec.rb b/spec/ruby/core/struct/struct_spec.rb index 11e619dcde..8817dc1a58 100644 --- a/spec/ruby/core/struct/struct_spec.rb +++ b/spec/ruby/core/struct/struct_spec.rb @@ -21,7 +21,7 @@ describe "Struct anonymous class instance methods" do it "reader method should not interfere with undefined methods" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car.something_weird }.should raise_error(NoMethodError) + -> { car.something_weird }.should raise_error(NoMethodError) end it "writer method be a synonym for []=" do diff --git a/spec/ruby/core/struct/values_at_spec.rb b/spec/ruby/core/struct/values_at_spec.rb index f9602d53f7..7e517cdb4b 100644 --- a/spec/ruby/core/struct/values_at_spec.rb +++ b/spec/ruby/core/struct/values_at_spec.rb @@ -11,6 +11,6 @@ describe "Struct#values_at" do it "fails when passed unsupported types" do car = StructClasses::Car.new('Ford', 'Ranger') - lambda { car.values_at('make') }.should raise_error(TypeError) + -> { car.values_at('make') }.should raise_error(TypeError) end end |