Sha256: e60d1c35da92fb74d11ea83b0aa01d40df22b715a4010e7be326267f45ef070f
Contents?: true
Size: 1.81 KB
Versions: 5
Compression:
Stored size: 1.81 KB
Contents
require 'spec_helper' module Vim module Flavor describe VersionConstraint do describe '#compatible?' do describe '>=' do subject {VersionConstraint.new('>= 1.2.3')} it {should be_compatible '1.2.3'} it {should be_compatible '1.2.4'} it {should be_compatible '1.3.3'} it {should be_compatible '2.2.3'} it {should be_compatible '1.3'} it {should_not be_compatible '1.2.2'} it {should_not be_compatible '1.1.3'} it {should_not be_compatible '0.2.3'} it {should_not be_compatible '1.2'} end describe '~>' do subject {VersionConstraint.new('~> 1.2.3')} it {should be_compatible '1.2.3'} it {should be_compatible '1.2.4'} it {should_not be_compatible '1.3.3'} it {should_not be_compatible '2.2.3'} it {should_not be_compatible '1.3'} it {should_not be_compatible '1.2.2'} it {should_not be_compatible '1.1.3'} it {should_not be_compatible '0.2.3'} it {should_not be_compatible '1.2'} end end describe '#find_the_best_version' do it 'returns the best version from given versions' do VersionConstraint.new('>= 1.2.3'). find_the_best_version(['1.2.2', '1.2.3', '1.2.4', '1.3.3', '2.0']). should == '2.0' VersionConstraint.new('~> 1.2.3'). find_the_best_version(['1.2.2', '1.2.3', '1.2.4', '1.3.3', '2.0']). should == '1.2.4' end it 'fails if no version is given' do expect { VersionConstraint.new('>= 1.2.3'). find_the_best_version([]).tap {|v| p v} }.to raise_error(RuntimeError, 'There is no valid version') end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems