Sha256: 0b99d5290d46a13e97a71ab2fdec26b4d376c1cd7bc37c24aae8f38aa9f852ed

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

require 'spec/helper'

describe "Struct.fill" do

  Point = Struct.new(:x,:y)
  it "should return a well set struct" do
    p = Point.fill(:x=>1,:y=>2)
    p.should be_an_instance_of(Point)
    p[0].should == 1
    p[1].should == 2
  end

  it "should work with partial arguments" do
    p = Point.fill(:x=>1)
    p.should be_an_instance_of(Point)
    p[0].should == 1
    p[1].should == nil
  end

  it "should not fail with foreign keys" do
    p = Point.fill(:k=>1)
    p.should be_an_instance_of(Point)
    p[0].should == nil
    p[1].should == nil
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 spec/snippets/struct/fill.rb
ramaze-0.2.1 spec/snippets/struct/fill.rb
ramaze-0.2.0 spec/snippets/struct/fill.rb