Sha256: f63ff92c31541f74da7e699420b5cafbdacfa6b49337b18757682a482d947e4e
Contents?: true
Size: 1.96 KB
Versions: 10
Compression:
Stored size: 1.96 KB
Contents
# frozen_string_literal: true 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(:exist?).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(:exist?).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(:exist?).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(:exist?).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(:exist?).with('./Gemfile.lock').and_return(false) gem_spec = Rewriter::GemSpec.new('ast', '1.1.0') expect(gem_spec).to be_match end end end
Version data entries
10 entries across 10 versions & 1 rubygems