Sha256: a17960e8d7cfa058f08517d56de5d08fbe709b9f5d0fa29382a14274f7305c88
Contents?: true
Size: 1.94 KB
Versions: 31
Compression:
Stored size: 1.94 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', '~> 1.1') 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', '> 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
31 entries across 31 versions & 1 rubygems