Sha256: c529de699a94ac83be2113331eeca1161977fd0cfebe3018025fb98ae335c17c

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'ore/versions/version'

describe Ore::Versions::Version do
  subject { Ore::Versions::Version }

  describe "new" do
    let(:stable) { subject.new(1,2,3) }
    let(:beta) { subject.new(1,2,3,'beta4') }

    it "should default the major, minor and patch numbers to 0" do
      v = subject.new(nil,nil,nil)

      v.major.should == 0
      v.minor.should == 0
      v.patch.should == 0
    end

    it "should default the build string to nil" do
      stable.build.should == nil
    end

    it "should construct a version string from the numbers" do
      stable.version.should == '1.2.3'
    end

    it "should append the build string to the version" do
      beta.version.should == '1.2.3.beta4'
    end
  end

  describe "parse" do
    let(:stable) { '1.2.3' }
    let(:beta) { '1.2.3.beta4' }

    it "should parse the major, minor and patch version numbers" do
      v = subject.parse(stable)

      v.major.should == 1
      v.minor.should == 2
      v.patch.should == 3
    end

    it "should parse the build string if given" do
      v = subject.parse(beta)

      v.major.should == 1
      v.minor.should == 2
      v.patch.should == 3
      v.build.should == 'beta4'
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ore-core-0.1.5 spec/versions/version_spec.rb
ore-core-0.1.4 spec/versions/version_spec.rb
ore-core-0.1.3 spec/versions/version_spec.rb
ore-core-0.1.2 spec/versions/version_spec.rb
ore-core-0.1.1 spec/versions/version_spec.rb
ore-core-0.1.0 spec/versions/version_spec.rb
ore-0.2.3 spec/versions/version_spec.rb
ore-0.2.2 spec/versions/version_spec.rb
ore-0.2.1 spec/versions/version_spec.rb
ore-0.2.0 spec/versions/version_spec.rb
ore-0.1.4 spec/versions/version_spec.rb
ore-0.1.3 spec/versions/version_spec.rb
ore-0.1.2 spec/versions/version_spec.rb