Sha256: 368a428be442beb686950a9495b6a1d0c04c356b2235d03c5694fba42b2aadf7

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
require 'rspec'
require 'image_optim/bin_resolver/simple_version'

describe ImageOptim::BinResolver::SimpleVersion do
  def v(str)
    ImageOptim::BinResolver::SimpleVersion.new(str)
  end

  it 'should compare versions' do
    expect(v '1.17').to be > '0'
    expect(v '1.17').to be > '0.1'
    expect(v '1.17').to be > '0.9'
    expect(v '1.17').to be > '1.9'
    expect(v '1.17').to be < '1.17.1'
    expect(v '1.17').to be < '1.99'
    expect(v '1.17').to be < '2.1'
  end

  it 'should normalize versions' do
    variations = %w[1 01 1.0 1.00 1.0.0 1.0.0.0]
    variations.each do |a|
      variations.each do |b|
        expect(v a).to eq(b)
      end
    end
  end

  it 'should convert objects' do
    expect(v 1.17).to eq('1.17')
    expect(v '1.17').to eq('1.17')
    expect(v(v 1.17)).to eq('1.17')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
image_optim-0.17.1 spec/image_optim/bin_resolver/simple_version_spec.rb
image_optim-0.17.0 spec/image_optim/bin_resolver/simple_version_spec.rb
image_optim-0.16.0 spec/image_optim/bin_resolver/simple_version_spec.rb
image_optim-0.15.0 spec/image_optim/bin_resolver/simple_version_spec.rb
image_optim-0.14.0 spec/image_optim/bin_resolver/simple_version_spec.rb