Sha256: ec8b1267e5f2051f7261066684c2290b5e6c0f39bd6c939c85ce6b209153241c
Contents?: true
Size: 664 Bytes
Versions: 52
Compression:
Stored size: 664 Bytes
Contents
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe "Struct#values_at" do it "returns an array of values" do clazz = Struct.new(:name, :director, :year) movie = clazz.new('Sympathy for Mr. Vengence', 'Chan-wook Park', 2002) movie.values_at(0, 1).should == ['Sympathy for Mr. Vengence', 'Chan-wook Park'] movie.values_at(0..2).should == ['Sympathy for Mr. Vengence', 'Chan-wook Park', 2002] end it "fails when passed unsupported types" do car = StructClasses::Car.new('Ford', 'Ranger') lambda { car.values_at('make') }.should raise_error(TypeError) end end
Version data entries
52 entries across 52 versions & 2 rubygems