Sha256: 8a4ea747e08b131dd49c560d674613935ee759b35b792ae08ec6a5def0809b36
Contents?: true
Size: 1.04 KB
Versions: 10
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' require 'image_optim/bin_resolver/comparable_condition' describe ImageOptim::BinResolver::ComparableCondition do is = ImageOptim::BinResolver::ComparableCondition.is it 'builds conditions' do expect(is.between?(10, 20).method).to eq(:between?) expect(is.between?(10, 20).args).to eq([10, 20]) expect((is >= 15).method).to eq(:>=) expect((is >= 15).args).to eq([15]) expect((is < 30).method).to eq(:<) expect((is < 30).args).to eq([30]) end it 'stringifies conditions' do expect(is.between?(10, 20).to_s).to eq('10..20') expect((is >= 15).to_s).to eq('>= 15') expect((is < 30).to_s).to eq('< 30') end it 'matches conditions' do expect(is.between?(10, 20)).not_to match 9 expect(is.between?(10, 20)).to match 15 expect(is.between?(10, 20)).not_to match 21 expect(is >= 15).not_to match 14 expect(is >= 15).to match 15 expect(is >= 15).to match 16 expect(is < 30).to match 29 expect(is < 30).not_to match 30 expect(is < 30).not_to match 31 end end
Version data entries
10 entries across 10 versions & 2 rubygems