spec/unit/dependency/requirement_spec.rb in librarianp-0.1.2 vs spec/unit/dependency/requirement_spec.rb in librarianp-0.2.0
- old
+ new
@@ -7,6 +7,30 @@
specify { expect(requirement.inspect).
to eq "#<Librarian::Dependency::Requirement >= 3.2.1>" }
end
+ it 'should handle nil versions' do
+ described_class.new(nil).to_gem_requirement.should eq(Gem::Requirement.new)
+ end
+
+ it 'should handle nil versions in arrays' do
+ described_class.new([nil]).to_gem_requirement.should eq(Gem::Requirement.new)
+ end
+
+ it 'should handle .x versions' do
+ described_class.new('1.x').to_gem_requirement.should eq(Gem::Requirement.new('~> 1.0'))
+ described_class.new('1.0.x').to_gem_requirement.should eq(Gem::Requirement.new('~> 1.0.0'))
+ end
+
+ it 'should handle version ranges' do
+ described_class.new('>=1.1.0 <2.0.0').to_gem_requirement.should eq(Gem::Requirement.new(['>=1.1.0', '<2.0.0']))
+ end
+
+ it 'should print to_s' do
+ described_class.new('1.x').to_s.should eq('~> 1.0')
+ s = described_class.new('>=1.1.0 <2.0.0').to_s
+ s.should include(">= 1.1.0")
+ s.should include("< 2.0.0")
+ end
+
end