Sha256: 0ec439859a0c5156c2d865d80aae892fc11d6269c38ce3c26bb910594b3ab2c2

Contents?: true

Size: 901 Bytes

Versions: 2

Compression:

Stored size: 901 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe V8::Integer do 
  subject { V8::Integer }
  setup_context
  
  it "inherits V8::Number" do
    pending "Needs to separate V8::Number"
    subject.new(10).should be_kind_of(V8::Number)
  end

  describe ".new" do
    it "creates new v8 integer based on passed value" do
      subject.new(10).should == 10
      subject.new(-10).should == -10
    end
  end

  describe "#to_i" do
    it "returns fixnum value of represented integer" do
      subject.new(10).to_i.should == 10
    end
  end

  describe "an instance" do
    it "is comparable" do
      int = subject.new(10)
      int.should == 10
      int.should_not == 20
      int.should > 5
      int.should < 15
      int.should <= 10
      int.should >= 10
    end
    
    it "is delegated properly" do
      int = subject.new(3)
      int.delegate.should == int.to_i
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mustang-0.1.1 spec/v8/integer_spec.rb
mustang-0.1.0 spec/v8/integer_spec.rb