Sha256: bb1050aca7c278f6075e0db5fa346f7b651ca33f5775764d841791d166eb6551
Contents?: true
Size: 1.88 KB
Versions: 9
Compression:
Stored size: 1.88 KB
Contents
require 'spec_helper' describe Minimart::InventoryRequirement::SupermarketRequirementsBuilder do let(:versions) { ['> 1.0.0', '~> 0.1'] } subject do described_class.new('mysql', 'versions' => versions) end describe '#build' do it 'should return an array' do expect(subject.build).to be_a Array end it 'should build requirements using the base requirement class' do expect(subject.build.first).to be_a Minimart::InventoryRequirement::BaseRequirement end it "should build a requirement for version '> 1.0.0'" do requirements = subject.build expect(requirements.any? { |r| r.version_requirement == '> 1.0.0'}).to eq true end it "should build a requirement for version '~> 0.1'" do requirements = subject.build expect(requirements.any? { |r| r.version_requirement == '~> 0.1'}).to eq true end context 'when no versions are supplied' do subject do described_class.new('mysql', {}) end it 'should return an empty array' do expect(subject.build).to be_empty end end context 'when a string version is supplied' do subject do described_class.new('mysql', 'versions' => '~> 0.1') end it 'should build a single requirement' do expect(subject.build.size).to eq 1 end it 'should give the requirement the proper version' do expect(subject.build.first.version_requirement).to eq '~> 0.1' end it 'should give the requirement the proper name' do expect(subject.build.first.name).to eq 'mysql' end end context 'when the string "version" is used as the key' do subject do described_class.new('mysql', 'version' => '~> 0.1') end it 'should give the requirement the proper version' do expect(subject.build.first.version_requirement).to eq '~> 0.1' end end end end
Version data entries
9 entries across 9 versions & 1 rubygems