Sha256: ed4ff271474b92abf9e9487c60d3a24a894a7753560266006b4eebb867ebcc73
Contents?: true
Size: 1.97 KB
Versions: 24
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' module Synvert::Core describe Rewriter::GemSpec do let(:gemfile_lock_content) { """ GEM remote: https://rubygems.org/ specs: ast (1.1.0) parser (2.1.7) ast (~> 1.1) slop (~> 3.4, >= 3.4.5) rake (10.1.1) slop (3.4.7) """} it 'returns true if version in Gemfile.lock is greater than definition' do expect(File).to receive(:exists?).with('./Gemfile.lock').and_return(true) expect(File).to receive(:read).with('./Gemfile.lock').and_return(gemfile_lock_content) gem_spec = Rewriter::GemSpec.new('ast', {gte: '1.0.0'}) expect(gem_spec).to be_match end it 'returns true if version in Gemfile.lock is equal to definition' do expect(File).to receive(:exists?).with('./Gemfile.lock').and_return(true) expect(File).to receive(:read).with('./Gemfile.lock').and_return(gemfile_lock_content) gem_spec = Rewriter::GemSpec.new('ast', '1.1.0') expect(gem_spec).to be_match end it 'returns false if version in Gemfile.lock is less than definition' do expect(File).to receive(:exists?).with('./Gemfile.lock').and_return(true) expect(File).to receive(:read).with('./Gemfile.lock').and_return(gemfile_lock_content) gem_spec = Rewriter::GemSpec.new('ast', {gt: '1.2.0'}) expect(gem_spec).not_to be_match end it 'returns false if gem does not exist in Gemfile.lock' do expect(File).to receive(:exists?).with('./Gemfile.lock').and_return(true) expect(File).to receive(:read).with('./Gemfile.lock').and_return(gemfile_lock_content) gem_spec = Rewriter::GemSpec.new('synvert', '1.0.0') expect(gem_spec).not_to be_match end it 'raise Synvert::Core::GemfileLockNotFound if Gemfile.lock does not exist' do expect(File).to receive(:exists?).with('./Gemfile.lock').and_return(false) gem_spec = Rewriter::GemSpec.new('ast', '1.1.0') expect { gem_spec.match? }.to raise_error(Synvert::Core::GemfileLockNotFound) end end end
Version data entries
24 entries across 24 versions & 1 rubygems