Skip to content

Commit

Permalink
Update to newer minitest spec syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Dec 11, 2024
1 parent be039a6 commit bf4162d
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 187 deletions.
86 changes: 43 additions & 43 deletions spec/artifact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,67 @@
describe Maven::Tools::Artifact do

it 'should convert from coordinate' do
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:123' ).to_s.must_equal 'sdas:das:jar:tes:123'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:123' ).to_s.must_equal 'sdas:das:jar:123'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:[123,234]' ).to_s.must_equal 'sdas:das:jar:tes:[123,234]'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:[123,234]' ).to_s.must_equal 'sdas:das:jar:[123,234]'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:123:[de:fr,gb:us]' ).to_s.must_equal 'sdas:das:jar:tes:123:[de:fr,gb:us]'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:123:[de:fr,gb:us]' ).to_s.must_equal 'sdas:das:jar:123:[de:fr,gb:us]'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:[123,234]:[de:fr,gb:us]' ).to_s.must_equal 'sdas:das:jar:tes:[123,234]:[de:fr,gb:us]'
Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:[123,234]:[de:fr,gb:us]' ).to_s.must_equal 'sdas:das:jar:[123,234]:[de:fr,gb:us]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:123' ).to_s).must_equal 'sdas:das:jar:tes:123'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:123' ).to_s).must_equal 'sdas:das:jar:123'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:[123,234]' ).to_s).must_equal 'sdas:das:jar:tes:[123,234]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:[123,234]' ).to_s).must_equal 'sdas:das:jar:[123,234]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:123:[de:fr,gb:us]' ).to_s).must_equal 'sdas:das:jar:tes:123:[de:fr,gb:us]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:123:[de:fr,gb:us]' ).to_s).must_equal 'sdas:das:jar:123:[de:fr,gb:us]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:tes:[123,234]:[de:fr,gb:us]' ).to_s).must_equal 'sdas:das:jar:tes:[123,234]:[de:fr,gb:us]'
_(Maven::Tools::Artifact.from_coordinate( 'sdas:das:jar:[123,234]:[de:fr,gb:us]' ).to_s).must_equal 'sdas:das:jar:[123,234]:[de:fr,gb:us]'
end

it 'should setup artifact' do
Maven::Tools::Artifact.new( "sdas", "das", "jar", "123", "tes" ).to_s.must_equal 'sdas:das:jar:tes:123'
Maven::Tools::Artifact.new( "sdas", "das", "jar", "123" ).to_s.must_equal 'sdas:das:jar:123'
Maven::Tools::Artifact.new( "sdas.asd", "das", "jar", "123", ["fds:fre"] ).to_s.must_equal 'sdas.asd:das:jar:123:[fds:fre]'
Maven::Tools::Artifact.new( "sdas.asd", "das", "jar","123", "bla", ["fds:fre", "ferf:de"] ).to_s.must_equal 'sdas.asd:das:jar:bla:123:[fds:fre,ferf:de]'
Maven::Tools::Artifact.new( "sdas.asd", "das", "jar", "123", "blub", ["fds:fre", "ferf:de"] ).to_s.must_equal 'sdas.asd:das:jar:blub:123:[fds:fre,ferf:de]'
_(Maven::Tools::Artifact.new( "sdas", "das", "jar", "123", "tes" ).to_s).must_equal 'sdas:das:jar:tes:123'
_(Maven::Tools::Artifact.new( "sdas", "das", "jar", "123" ).to_s).must_equal 'sdas:das:jar:123'
_(Maven::Tools::Artifact.new( "sdas.asd", "das", "jar", "123", ["fds:fre"] ).to_s).must_equal 'sdas.asd:das:jar:123:[fds:fre]'
_(Maven::Tools::Artifact.new( "sdas.asd", "das", "jar","123", "bla", ["fds:fre", "ferf:de"] ).to_s).must_equal 'sdas.asd:das:jar:bla:123:[fds:fre,ferf:de]'
_(Maven::Tools::Artifact.new( "sdas.asd", "das", "jar", "123", "blub", ["fds:fre", "ferf:de"] ).to_s).must_equal 'sdas.asd:das:jar:blub:123:[fds:fre,ferf:de]'
end

it 'should convert ruby version contraints - gems' do
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '=1' ).to_s.must_equal 'rubygems:asd:gem:[1,1.0.0.0.0.1)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '>=1' ).to_s.must_equal 'rubygems:asd:gem:[1,)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=1' ).to_s.must_equal 'rubygems:asd:gem:[0,1]'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '>1' ).to_s.must_equal 'rubygems:asd:gem:(1,)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<1' ).to_s.must_equal 'rubygems:asd:gem:[0,1)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '!=1' ).to_s.must_equal 'rubygems:asd:gem:(1,)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<2', '>1' ).to_s.must_equal 'rubygems:asd:gem:(1,2)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=2', '>1' ).to_s.must_equal 'rubygems:asd:gem:(1,2]'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<2', '>=1' ).to_s.must_equal 'rubygems:asd:gem:[1,2)'
Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=2', '>=1' ).to_s.must_equal 'rubygems:asd:gem:[1,2]'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '=1' ).to_s).must_equal 'rubygems:asd:gem:[1,1.0.0.0.0.1)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '>=1' ).to_s).must_equal 'rubygems:asd:gem:[1,)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=1' ).to_s).must_equal 'rubygems:asd:gem:[0,1]'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '>1' ).to_s).must_equal 'rubygems:asd:gem:(1,)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<1' ).to_s).must_equal 'rubygems:asd:gem:[0,1)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '!=1' ).to_s).must_equal 'rubygems:asd:gem:(1,)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<2', '>1' ).to_s).must_equal 'rubygems:asd:gem:(1,2)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=2', '>1' ).to_s).must_equal 'rubygems:asd:gem:(1,2]'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<2', '>=1' ).to_s).must_equal 'rubygems:asd:gem:[1,2)'
_(Maven::Tools::Artifact.from( :gem, 'rubygems:asd', '<=2', '>=1' ).to_s).must_equal 'rubygems:asd:gem:[1,2]'
end

it 'should convert ruby version contraints - jars' do
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '=1' ).to_s.must_equal 'org.something:asd:jar:[1,1.0.0.0.0.1)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '>=1' ).to_s.must_equal 'org.something:asd:jar:[1,)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=1' ).to_s.must_equal 'org.something:asd:jar:[0,1]'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '>1' ).to_s.must_equal 'org.something:asd:jar:(1,)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<1' ).to_s.must_equal 'org.something:asd:jar:[0,1)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '!=1' ).to_s.must_equal 'org.something:asd:jar:(1,)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<2', '>1' ).to_s.must_equal 'org.something:asd:jar:(1,2)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=2', '>1' ).to_s.must_equal 'org.something:asd:jar:(1,2]'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<2', '>=1' ).to_s.must_equal 'org.something:asd:jar:[1,2)'
Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=2', '>=1' ).to_s.must_equal 'org.something:asd:jar:[1,2]'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '=1' ).to_s).must_equal 'org.something:asd:jar:[1,1.0.0.0.0.1)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '>=1' ).to_s).must_equal 'org.something:asd:jar:[1,)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=1' ).to_s).must_equal 'org.something:asd:jar:[0,1]'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '>1' ).to_s).must_equal 'org.something:asd:jar:(1,)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<1' ).to_s).must_equal 'org.something:asd:jar:[0,1)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '!=1' ).to_s).must_equal 'org.something:asd:jar:(1,)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<2', '>1' ).to_s).must_equal 'org.something:asd:jar:(1,2)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=2', '>1' ).to_s).must_equal 'org.something:asd:jar:(1,2]'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<2', '>=1' ).to_s).must_equal 'org.something:asd:jar:[1,2)'
_(Maven::Tools::Artifact.from( :jar, 'org.something:asd', '<=2', '>=1' ).to_s).must_equal 'org.something:asd:jar:[1,2]'
end

it 'passes in scope to artifact' do
a = Maven::Tools::Artifact.from( :jar, 'org.something:asd', '1' )
a.to_s.must_equal 'org.something:asd:jar:1'
a[ :scope ].must_be_nil
_(a.to_s).must_equal 'org.something:asd:jar:1'
_(a[ :scope ]).must_be_nil
a = Maven::Tools::Artifact.from( :jar, 'org.something:asd', '1', :scope => :provided )
a.to_s.must_equal 'org.something:asd:jar:1'
a[ :scope ].must_equal :provided
_(a.to_s).must_equal 'org.something:asd:jar:1'
_(a[ :scope ]).must_equal :provided
end
it 'passes in exclusions to artifact' do
a = Maven::Tools::Artifact.from( :jar, 'org.something:asd', '1' )
a.to_s.must_equal 'org.something:asd:jar:1'
a[ :exclusions ].must_be_nil
_(a.to_s).must_equal 'org.something:asd:jar:1'
_(a[ :exclusions ]).must_be_nil
a = Maven::Tools::Artifact.from( :jar, 'org.something:asd', '1', :exclusions => ["org.something:dsa"] )
a.to_s.must_equal 'org.something:asd:jar:1:[org.something:dsa]'
a[ :exclusions ].must_equal [ 'org.something:dsa' ]
_(a.to_s).must_equal 'org.something:asd:jar:1:[org.something:dsa]'
_(a[ :exclusions ]).must_equal [ 'org.something:dsa' ]
a = Maven::Tools::Artifact.from( :jar, 'org.something:asd', '1', :exclusions => ["org.something:dsa", "org.anything:qwe"] )
a.to_s.must_equal 'org.something:asd:jar:1:[org.something:dsa,org.anything:qwe]'
a[ :exclusions ].must_equal [ 'org.something:dsa', 'org.anything:qwe' ]
_(a.to_s).must_equal 'org.something:asd:jar:1:[org.something:dsa,org.anything:qwe]'
_(a[ :exclusions ]).must_equal [ 'org.something:dsa', 'org.anything:qwe' ]
end
end
110 changes: 55 additions & 55 deletions spec/coordinate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,75 +9,75 @@ class A
subject { A.new }

it 'should convert ruby version to maven version ranges' do
subject.to_version.must_equal "[0,)"
subject.to_version('!=2.3.4').must_equal "(2.3.4,)"
subject.to_version('!=2.3.4.rc').must_equal "(2.3.4.rc-SNAPSHOT,)"
subject.to_version('=2.3.4').must_equal "[2.3.4,2.3.4.0.0.0.0.1)"
subject.to_version('=2.3.4.alpha').must_equal "2.3.4.alpha"
subject.to_version('~>1.8.2').must_equal "[1.8.2,1.8.99999]"
subject.to_version('~>1.8.2.beta').must_equal "[1.8.2.beta-SNAPSHOT,1.8.99999]"
subject.to_version('~>1.8.2.beta123.12').must_equal "[1.8.2.beta123.12-SNAPSHOT,1.8.99999]"
subject.to_version('~>1.8.2.1beta').must_equal "[1.8.2.1beta-SNAPSHOT,1.8.99999]"
subject.to_version('~>1.8').must_equal "[1.8,1.99999]"
subject.to_version('~>0').must_equal "[0,99999]"
subject.to_version('>1.2').must_equal "(1.2,)"
subject.to_version('>1.2.GA').must_equal "(1.2.GA-SNAPSHOT,)"
subject.to_version('<1.2').must_equal "[0,1.2)"
subject.to_version('<1.2.dev').must_equal "[0,1.2.dev-SNAPSHOT)"
subject.to_version('>=1.2').must_equal "[1.2,)"
subject.to_version('>=1.2.gamma').must_equal "[1.2.gamma-SNAPSHOT,)"
subject.to_version('<=1.2').must_equal "[0,1.2]"
subject.to_version('<=1.2.pre').must_equal "[0,1.2.pre-SNAPSHOT]"
subject.to_version('>=1.2', '<2.0').must_equal "[1.2,2.0)"
subject.to_version('>=1.2', '<=2.0').must_equal "[1.2,2.0]"
subject.to_version('>1.2', '<2.0').must_equal "(1.2,2.0)"
subject.to_version('>1.2', '<=2.0').must_equal "(1.2,2.0]"
_(subject.to_version).must_equal "[0,)"
_(subject.to_version('!=2.3.4')).must_equal "(2.3.4,)"
_(subject.to_version('!=2.3.4.rc')).must_equal "(2.3.4.rc-SNAPSHOT,)"
_(subject.to_version('=2.3.4')).must_equal "[2.3.4,2.3.4.0.0.0.0.1)"
_(subject.to_version('=2.3.4.alpha')).must_equal "2.3.4.alpha"
_(subject.to_version('~>1.8.2')).must_equal "[1.8.2,1.8.99999]"
_(subject.to_version('~>1.8.2.beta')).must_equal "[1.8.2.beta-SNAPSHOT,1.8.99999]"
_(subject.to_version('~>1.8.2.beta123.12')).must_equal "[1.8.2.beta123.12-SNAPSHOT,1.8.99999]"
_(subject.to_version('~>1.8.2.1beta')).must_equal "[1.8.2.1beta-SNAPSHOT,1.8.99999]"
_(subject.to_version('~>1.8')).must_equal "[1.8,1.99999]"
_(subject.to_version('~>0')).must_equal "[0,99999]"
_(subject.to_version('>1.2')).must_equal "(1.2,)"
_(subject.to_version('>1.2.GA')).must_equal "(1.2.GA-SNAPSHOT,)"
_(subject.to_version('<1.2')).must_equal "[0,1.2)"
_(subject.to_version('<1.2.dev')).must_equal "[0,1.2.dev-SNAPSHOT)"
_(subject.to_version('>=1.2')).must_equal "[1.2,)"
_(subject.to_version('>=1.2.gamma')).must_equal "[1.2.gamma-SNAPSHOT,)"
_(subject.to_version('<=1.2')).must_equal "[0,1.2]"
_(subject.to_version('<=1.2.pre')).must_equal "[0,1.2.pre-SNAPSHOT]"
_(subject.to_version('>=1.2', '<2.0')).must_equal "[1.2,2.0)"
_(subject.to_version('>=1.2', '<=2.0')).must_equal "[1.2,2.0]"
_(subject.to_version('>1.2', '<2.0')).must_equal "(1.2,2.0)"
_(subject.to_version('>1.2', '<=2.0')).must_equal "(1.2,2.0]"
end

it 'should keep maven version and ranges as they are' do
subject.to_version('1.2.3').must_equal "1.2.3"
subject.to_version('(1,2)').must_equal "(1,2)"
subject.to_version('[1,2)').must_equal "[1,2)"
subject.to_version('(1,2]').must_equal "(1,2]"
subject.to_version('[1,2]').must_equal "[1,2]"
_(subject.to_version('1.2.3')).must_equal "1.2.3"
_(subject.to_version('(1,2)')).must_equal "(1,2)"
_(subject.to_version('[1,2)')).must_equal "[1,2)"
_(subject.to_version('(1,2]')).must_equal "(1,2]"
_(subject.to_version('[1,2]')).must_equal "[1,2]"
end

it 'should keep maven snapshot version and ranges as they are' do
subject.to_version('1.2.3-SNAPSHOT').must_equal "1.2.3-SNAPSHOT"
subject.to_version('(1,2-SNAPSHOT)').must_equal "(1,2-SNAPSHOT)"
subject.to_version('[1-SNAPSHOT,2)').must_equal "[1-SNAPSHOT,2)"
subject.to_version('(1,2-SNAPSHOT]').must_equal "(1,2-SNAPSHOT]"
subject.to_version('[1-SNAPSHOT,2]').must_equal "[1-SNAPSHOT,2]"
_(subject.to_version('1.2.3-SNAPSHOT')).must_equal "1.2.3-SNAPSHOT"
_(subject.to_version('(1,2-SNAPSHOT)')).must_equal "(1,2-SNAPSHOT)"
_(subject.to_version('[1-SNAPSHOT,2)')).must_equal "[1-SNAPSHOT,2)"
_(subject.to_version('(1,2-SNAPSHOT]')).must_equal "(1,2-SNAPSHOT]"
_(subject.to_version('[1-SNAPSHOT,2]')).must_equal "[1-SNAPSHOT,2]"
end

it 'should convert pom of jar deps to maven coordinate' do
subject.to_coordinate('something "a:b"').must_be_nil
subject.to_coordinate('#jar "a:b"').must_be_nil
subject.to_coordinate('jar "a:b" # bla').must_equal "a:b:jar:[0,)"
subject.to_coordinate("pom 'b:c', '!=2.3.4'").must_equal "b:c:pom:(2.3.4,)"
subject.to_coordinate('jar "c:d", "2.3.4"').must_equal "c:d:jar:2.3.4"
subject.to_coordinate("jar 'd:e', '~>1.8.2'").must_equal "d:e:jar:[1.8.2,1.8.99999]"
subject.to_coordinate('pom "f:g", ">1.2", "<=2.0"').must_equal "f:g:pom:(1.2,2.0]"
subject.to_coordinate('pom "e:f", "[1.8,1.9.9)"').must_equal "e:f:pom:[1.8,1.9.9)"
subject.to_coordinate('pom "e:f", "(1.8,1.9.9)"').must_equal "e:f:pom:(1.8,1.9.9)"
subject.to_coordinate('pom "e:f", "[1.8, 1.9.9]"').must_equal "e:f:pom:[1.8,1.9.9]"
_(subject.to_coordinate('something "a:b"')).must_be_nil
_(subject.to_coordinate('#jar "a:b"')).must_be_nil
_(subject.to_coordinate('jar "a:b" # bla')).must_equal "a:b:jar:[0,)"
_(subject.to_coordinate("pom 'b:c', '!=2.3.4'")).must_equal "b:c:pom:(2.3.4,)"
_(subject.to_coordinate('jar "c:d", "2.3.4"')).must_equal "c:d:jar:2.3.4"
_(subject.to_coordinate("jar 'd:e', '~>1.8.2'")).must_equal "d:e:jar:[1.8.2,1.8.99999]"
_(subject.to_coordinate('pom "f:g", ">1.2", "<=2.0"')).must_equal "f:g:pom:(1.2,2.0]"
_(subject.to_coordinate('pom "e:f", "[1.8,1.9.9)"')).must_equal "e:f:pom:[1.8,1.9.9)"
_(subject.to_coordinate('pom "e:f", "(1.8,1.9.9)"')).must_equal "e:f:pom:(1.8,1.9.9)"
_(subject.to_coordinate('pom "e:f", "[1.8, 1.9.9]"')).must_equal "e:f:pom:[1.8,1.9.9]"
end

it 'should support classifiers' do
subject.to_coordinate('something "a:b:jdk15"').must_be_nil
subject.to_coordinate('#jar "a:b:jdk15"').must_be_nil
subject.to_coordinate('jar "a:b:jdk15" # bla').must_equal "a:b:jar:jdk15:[0,)"
subject.to_coordinate("pom 'b:c:jdk15', '!=2.3.4'").must_equal "b:c:pom:jdk15:(2.3.4,)"
subject.to_coordinate('jar "c:d:jdk15", "2.3.4"').must_equal "c:d:jar:jdk15:2.3.4"
subject.to_coordinate("jar 'd:e:jdk15', '~>1.8.2'").must_equal "d:e:jar:jdk15:[1.8.2,1.8.99999]"
subject.to_coordinate('pom "f:g:jdk15", ">1.2", "<=2.0"').must_equal "f:g:pom:jdk15:(1.2,2.0]"
subject.to_coordinate('pom "e:f:jdk15", "[1.8,1.9.9)"').must_equal "e:f:pom:jdk15:[1.8,1.9.9)"
subject.to_coordinate('pom "e:f:jdk15", "(1.8,1.9.9)"').must_equal "e:f:pom:jdk15:(1.8,1.9.9)"
subject.to_coordinate('pom "e:f:jdk15", "[1.8, 1.9.9]"').must_equal "e:f:pom:jdk15:[1.8,1.9.9]"
_(subject.to_coordinate('something "a:b:jdk15"')).must_be_nil
_(subject.to_coordinate('#jar "a:b:jdk15"')).must_be_nil
_(subject.to_coordinate('jar "a:b:jdk15" # bla')).must_equal "a:b:jar:jdk15:[0,)"
_(subject.to_coordinate("pom 'b:c:jdk15', '!=2.3.4'")).must_equal "b:c:pom:jdk15:(2.3.4,)"
_(subject.to_coordinate('jar "c:d:jdk15", "2.3.4"')).must_equal "c:d:jar:jdk15:2.3.4"
_(subject.to_coordinate("jar 'd:e:jdk15', '~>1.8.2'")).must_equal "d:e:jar:jdk15:[1.8.2,1.8.99999]"
_(subject.to_coordinate('pom "f:g:jdk15", ">1.2", "<=2.0"')).must_equal "f:g:pom:jdk15:(1.2,2.0]"
_(subject.to_coordinate('pom "e:f:jdk15", "[1.8,1.9.9)"')).must_equal "e:f:pom:jdk15:[1.8,1.9.9)"
_(subject.to_coordinate('pom "e:f:jdk15", "(1.8,1.9.9)"')).must_equal "e:f:pom:jdk15:(1.8,1.9.9)"
_(subject.to_coordinate('pom "e:f:jdk15", "[1.8, 1.9.9]"')).must_equal "e:f:pom:jdk15:[1.8,1.9.9]"
end

it 'supports declarations with scope' do
subject.to_split_coordinate_with_scope('jar rubygems:ruby-maven, ~> 3.1.1.0, :scope => :provided').must_equal [:provided, "rubygems", "ruby-maven", "jar", "[3.1.1.0,3.1.1.99999]"]
subject.to_split_coordinate_with_scope("jar 'rubygems:ruby-maven', '~> 3.1.1.0', :scope => :test").must_equal [:test, "rubygems", "ruby-maven", "jar", "[3.1.1.0,3.1.1.99999]"]
_(subject.to_split_coordinate_with_scope('jar rubygems:ruby-maven, ~> 3.1.1.0, :scope => :provided')).must_equal [:provided, "rubygems", "ruby-maven", "jar", "[3.1.1.0,3.1.1.99999]"]
_(subject.to_split_coordinate_with_scope("jar 'rubygems:ruby-maven', '~> 3.1.1.0', :scope => :test")).must_equal [:test, "rubygems", "ruby-maven", "jar", "[3.1.1.0,3.1.1.99999]"]
end
end
8 changes: 4 additions & 4 deletions spec/dsl/gemspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ def self.read( name, artifact_id )
subject.new parent
xml = ""
Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
xml.must_equal( GemspecFile.read( 'maven-tools.xml', 'maven-tools' ) )
_(xml).must_equal( GemspecFile.read( 'maven-tools.xml', 'maven-tools' ) )
end

it 'evals maven_tools.gemspec from yaml' do
subject.new parent, 'maven-tools.gemspec'
xml = ""
Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
xml.must_equal( GemspecFile.read( 'maven-tools.xml', 'gemspec_spec' ) )
_(xml).must_equal( GemspecFile.read( 'maven-tools.xml', 'gemspec_spec' ) )
end

it 'evals gemspec with jar and pom dependencies' do
subject.new parent, 'jars_and_poms.gemspec'
xml = ""
Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
xml.must_equal( GemspecFile.read( 'jars_and_poms.xml',
_(xml).must_equal( GemspecFile.read( 'jars_and_poms.xml',
'gemspec_spec' ) )
end

it 'evals gemspec with jar and pom dependencies' do
subject.new parent, :name => 'jars_and_poms.gemspec', :include_jars => true
xml = ""
Maven::Tools::Visitor.new( xml ).accept_project( parent.model )
xml.must_equal( GemspecFile.read( 'jars_and_poms_include_jars.xml',
_(xml).must_equal( GemspecFile.read( 'jars_and_poms_include_jars.xml',
'gemspec_spec' ) )
end
end
Loading

0 comments on commit bf4162d

Please sign in to comment.