require 'spec_helper' module DistribBuilder module Versioner describe VersionProcessor do let(:processor) { described_class.new([1,2,3,4]) } it "does to be" do expect( VersionProcessor.new([]) ).to be end it "does return version's hash with names" do expect( processor.versions_hash ).to eq({ major: 1, minor: 2, patch: 3, build: 4 }) end it "does return 1.2.3" do expect( processor.only_version ).to eq("1.2.3") end it "does return 1.2.3.4" do expect( processor.full_version ).to eq("1.2.3.4") end it "does up build (mutate)" do expect( processor.build ).to eq(4) processor.build_up! expect( processor.build ).to eq(5) end it "does down build (mutate)" do expect( processor.build ).to eq(4) processor.build_down! expect( processor.build ).to eq(3) end it "does not down build if build == 0" do processor.build = 0 expect( processor.build ).to eq(0) processor.build_down! expect( processor.build ).to eq(0) end it "does setup build (mutate)" do processor.build = 5 expect( processor.build ).to eq(5) processor.setup_build!(12) expect( processor.build ).to eq(12) end it "does setup version (mutate)" do expect( processor.only_version ).to eq("1.2.3") processor.setup_version!("4.5.6") expect( processor.only_version ).to eq("4.5.6") end end end end