Sha256: 173df8633c28df96cccf267fd0ab0fef775b4d38a39ccee2e315e70ab53697e8

Contents?: true

Size: 1.47 KB

Versions: 13

Compression:

Stored size: 1.47 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/utils/version'

describe SpecVersion, "#to_s" do
  it "returns the string with which it was initialized" do
    SpecVersion.new("1.8").to_s.should == "1.8"
    SpecVersion.new("2.118.9.2").to_s.should == "2.118.9.2"
  end
end

describe SpecVersion, "#to_str" do
  it "returns the same string as #to_s" do
    version = SpecVersion.new("2.118.9.2")
    version.to_str.should == version.to_s
  end
end

describe SpecVersion, "#to_i with ceil = false" do
  it "returns an integer representation of the version string" do
    SpecVersion.new("1.8.6.22").to_i.should == 10108060022
  end

  it "replaces missing version parts with zeros" do
    SpecVersion.new("1.8").to_i.should == 10108000000
    SpecVersion.new("1.8.6").to_i.should == 10108060000
    SpecVersion.new("1.8.7.333").to_i.should == 10108070333
  end
end

describe SpecVersion, "#to_i with ceil = true" do
  it "returns an integer representation of the version string" do
    SpecVersion.new("1.8.6.22", true).to_i.should == 10108060022
  end

  it "fills in 9s for missing tiny and patchlevel values" do
    SpecVersion.new("1.8", true).to_i.should == 10108999999
    SpecVersion.new("1.8.6", true).to_i.should == 10108069999
    SpecVersion.new("1.8.7.333", true).to_i.should == 10108070333
  end
end

describe SpecVersion, "#to_int" do
  it "returns the same value as #to_i" do
    version = SpecVersion.new("4.16.87.333")
    version.to_int.should == version.to_i
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mspec-1.5.17 spec/utils/version_spec.rb
mspec-1.5.16 spec/utils/version_spec.rb
mspec-1.5.15 spec/utils/version_spec.rb
mspec-1.5.14 spec/utils/version_spec.rb
mspec-1.5.13 spec/utils/version_spec.rb
mspec-1.5.12 spec/utils/version_spec.rb
mspec-1.5.11 spec/utils/version_spec.rb
mspec-1.5.10 spec/utils/version_spec.rb
mspec-1.5.5 spec/utils/version_spec.rb
mspec-1.5.6 spec/utils/version_spec.rb
mspec-1.5.7 spec/utils/version_spec.rb
mspec-1.5.8 spec/utils/version_spec.rb
mspec-1.5.9 spec/utils/version_spec.rb