1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move spec/rubyspec to spec/ruby for consistency

* Other ruby implementations use the spec/ruby directory.
  [Misc #13792] [ruby-core:82287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-09-20 20:18:52 +00:00
parent 75bfc6440d
commit 1d15d5f080
4370 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,7 @@
describe :struct_accessor, shared: true do
it "does not override the instance accessor method" do
struct = Struct.new(@method.to_sym)
instance = struct.new 42
instance.send(@method).should == 42
end
end

View file

@ -0,0 +1,30 @@
describe :struct_equal_value, shared: true do
it "returns true if the other is the same object" do
car = same_car = StructClasses::Car.new("Honda", "Accord", "1998")
car.send(@method, same_car).should == true
end
it "returns true if the other has all the same fields" do
car = StructClasses::Car.new("Honda", "Accord", "1998")
similar_car = StructClasses::Car.new("Honda", "Accord", "1998")
car.send(@method, similar_car).should == true
end
it "returns false if the other is a different object or has different fields" do
car = StructClasses::Car.new("Honda", "Accord", "1998")
different_car = StructClasses::Car.new("Honda", "Accord", "1995")
car.send(@method, different_car).should == false
end
it "handles recursive structures by returning false if a difference can be found" do
x = StructClasses::Car.new("Honda", "Accord", "1998")
x[:make] = x
stepping = StructClasses::Car.new("Honda", "Accord", "1998")
stone = StructClasses::Car.new(stepping, "Accord", "1998")
stepping[:make] = stone
x.send(@method, stepping).should == true
stone[:year] = "1999" # introduce a difference
x.send(@method, stepping).should == false
end
end

View file

@ -0,0 +1,5 @@
describe :struct_inspect, shared: true do
it "returns a string representation without the class name for anonymous structs" do
Struct.new(:a).new("").send(@method).should == '#<struct a="">'
end
end