Sha256: 13d4cec101de5c10fd97114804d139be4938188e230ea65983e419a3632cdb5d

Contents?: true

Size: 1.4 KB

Versions: 8

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

module Vim
  module Flavor
    describe Version do
      v = described_class

      describe '::create' do
        context 'with a string' do
          it 'makes a PlainVersion' do
            expect(v.create('1.2.3')).to be_a(PlainVersion)
            expect(v.create('v1.2.3')).to be_a(PlainVersion)
          end
        end

        context 'with a branch' do
          it 'makes a BranchVersion' do
            r = v.create(branch: 'master')
            expect(r).to be_a(BranchVersion)
            expect(r.branch).to be == 'master'
            expect(r.revision).to be_nil
          end
        end

        context 'with a branch and a ref' do
          it 'makes a BranchVersion' do
            r = v.create(branch: 'master', revision: '1' * 40)
            expect(r).to be_a(BranchVersion)
            expect(r.branch).to be == 'master'
            expect(r.revision).to be == '1' * 40
          end
        end
      end

      describe '::correct?' do
        it 'is an alias of PlainVersion::correct?' do
          expect(v.correct?('1')).to be_truthy
          expect(v.correct?('1.2')).to be_truthy
          expect(v.correct?('1.2.3')).to be_truthy
          expect(v.correct?('v1')).to be_truthy
          expect(v.correct?('v1.2')).to be_truthy
          expect(v.correct?('v1.2.3')).to be_truthy
          expect(v.correct?('vim7.4')).to be_falsey
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vim-flavor-4.0.3 spec/version_spec.rb
vim-flavor-4.0.2 spec/version_spec.rb
vim-flavor-4.0.1 spec/version_spec.rb
vim-flavor-4.0.0 spec/version_spec.rb
vim-flavor-3.0.0 spec/version_spec.rb
vim-flavor-2.2.2 spec/version_spec.rb
vim-flavor-2.2.1 spec/version_spec.rb
vim-flavor-2.2.0 spec/version_spec.rb