Sha256: d289678419222f13e5ff564a5e534ce7b6224575781eba306b800108a75fd85b

Contents?: true

Size: 581 Bytes

Versions: 22

Compression:

Stored size: 581 Bytes

Contents

require 'spec_helper'

describe Vector2 do
  describe "#initialize" do
    def check(object)
      vector = Vector2.new(object)
      vector.x.should == 1
      vector.y.should == -2
    end

    it "should parse strings containing 2 integers" do
      check '1 -2'
      check '+1x-2'
      check '1,-2'
      check '+1-2'
      check '1  -2'
    end

    it "should interpret a 2-element array of integers as x- and y- values" do
      check [1, -2]
    end

    it "should interpret a 2-element array of strings as x- and y- values" do
      check ['1', '-2']
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bulldog-0.0.2 spec/unit/vector2_spec.rb
bulldog-0.0.1 spec/unit/vector2_spec.rb