2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
require_relative 'fixtures/classes'
|
|
|
|
require_relative 'shared/inspect'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Struct#inspect" do
|
|
|
|
it "returns a string representation of some kind" do
|
|
|
|
car = StructClasses::Car.new('Ford', 'Ranger')
|
|
|
|
car.inspect.should == '#<struct StructClasses::Car make="Ford", model="Ranger", year=nil>'
|
2017-09-14 11:56:33 -04:00
|
|
|
|
|
|
|
Whiskey = Struct.new(:name, :ounces)
|
|
|
|
Whiskey.new('Jack', 100).inspect.should == '#<struct Whiskey name="Jack", ounces=100>'
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
2018-01-29 11:08:16 -05:00
|
|
|
it_behaves_like :struct_inspect, :inspect
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|