diff --git a/spec/artifact_spec.rb b/spec/artifact_spec.rb index 1fe3611..8321c43 100644 --- a/spec/artifact_spec.rb +++ b/spec/artifact_spec.rb @@ -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 diff --git a/spec/coordinate_spec.rb b/spec/coordinate_spec.rb index bbf3cc4..0250f8e 100644 --- a/spec/coordinate_spec.rb +++ b/spec/coordinate_spec.rb @@ -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 diff --git a/spec/dsl/gemspec_spec.rb b/spec/dsl/gemspec_spec.rb index 015029e..4af6092 100644 --- a/spec/dsl/gemspec_spec.rb +++ b/spec/dsl/gemspec_spec.rb @@ -30,21 +30,21 @@ 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 @@ -52,7 +52,7 @@ def self.read( name, artifact_id ) 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 diff --git a/spec/dsl/jarfile_lock_spec.rb b/spec/dsl/jarfile_lock_spec.rb index 7eb2b86..7f5e09e 100644 --- a/spec/dsl/jarfile_lock_spec.rb +++ b/spec/dsl/jarfile_lock_spec.rb @@ -9,29 +9,29 @@ it 'loads legacy Jarfile.lock' do lock = subject.new( base + '.legacy' ) - lock.coordinates( :test ).size.must_equal 0 - lock.coordinates.size.must_equal 52 + _(lock.coordinates( :test ).size).must_equal 0 + _(lock.coordinates.size).must_equal 52 end it 'loads Jarfile.lock' do lock = subject.new( base ) - lock.coordinates( :test ).size.must_equal 7 - lock.coordinates.size.must_equal 45 + _(lock.coordinates( :test ).size).must_equal 7 + _(lock.coordinates.size).must_equal 45 end it 'tests existence' do lock = subject.new( base ) ( lock.coordinates( :test ) + lock.coordinates ).each do |c| - lock.exists?( c ).must_equal true - lock.exists?( c + ".bla" ).must_equal false + _(lock.exists?( c )).must_equal true + _(lock.exists?( c + ".bla" )).must_equal false end end it 'tests locked' do lock = subject.new( base ) ( lock.coordinates( :test ) + lock.coordinates ).each do |c| - lock.locked?( c ).must_equal true - lock.locked?( c + ".bla" ).must_equal true + _(lock.locked?( c )).must_equal true + _(lock.locked?( c + ".bla" )).must_equal true end end @@ -45,8 +45,8 @@ :runtime => [ 'huffle:puffle:321' ] } ) lock.dump lock = subject.new( file ) - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] ensure FileUtils.rm_f file_lock end @@ -57,43 +57,43 @@ lock.replace( { :test => [ 'bla:blas:123' ], :runtime => [ 'huffle:puffle:321' ] } ) - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] lock.replace( { :runtime => [ 'huffle:puffle:321' ] } ) - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal [] + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal [] lock.replace( { :test => [ 'bla:blas:123' ]} ) - lock.coordinates.must_equal [] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.coordinates).must_equal [] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] end it 'can add missing data idempotent' do lock = subject.new( 'something' ) - lock.update_unlocked( { :test => [ 'bla:blas:123' ], - :runtime => [ 'huffle:puffle:321' ] } ).must_equal true - lock.update_unlocked( { :test => [ 'bla:blas:123' ], - :runtime => [ 'huffle:puffle:321' ] } ).must_equal true - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :test => [ 'bla:blas:123' ], + :runtime => [ 'huffle:puffle:321' ] } )).must_equal true + _(lock.update_unlocked( { :test => [ 'bla:blas:123' ], + :runtime => [ 'huffle:puffle:321' ] } )).must_equal true + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :runtime => [ 'huffle:puffle:321' ] } ).must_equal true - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :runtime => [ 'huffle:puffle:321' ] } )).must_equal true + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :runtime => [ 'huffle:puffle2:321' ] } ).must_equal true - lock.coordinates.must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :runtime => [ 'huffle:puffle2:321' ] } )).must_equal true + _(lock.coordinates).must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :test => [ 'bla:blas:123' ]} ).must_equal true - lock.coordinates.must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :test => [ 'bla:blas:123' ]} )).must_equal true + _(lock.coordinates).must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :test => [ 'bla:bla2:123' ]} ).must_equal true - lock.coordinates.must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123', 'bla:bla2:123'] + _(lock.update_unlocked( { :test => [ 'bla:bla2:123' ]} )).must_equal true + _(lock.coordinates).must_equal ['huffle:puffle:321', 'huffle:puffle2:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123', 'bla:bla2:123'] end it 'fails add data on version conflict' do @@ -102,17 +102,17 @@ lock.replace( { :test => [ 'bla:blas:123' ], :runtime => [ 'huffle:puffle:321' ] } ) - lock.update_unlocked( { :test => [ 'bla:blas:1233' ], - :runtime => [ 'huffle:puffle:3214' ] } ).must_equal false - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :test => [ 'bla:blas:1233' ], + :runtime => [ 'huffle:puffle:3214' ] } )).must_equal false + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :runtime => [ 'huffle:puffle:3214' ] } ).must_equal false - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :runtime => [ 'huffle:puffle:3214' ] } )).must_equal false + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] - lock.update_unlocked( { :test => [ 'bla:blas:1233' ]} ).must_equal false - lock.coordinates.must_equal ['huffle:puffle:321'] - lock.coordinates( :test ).must_equal ['bla:blas:123'] + _(lock.update_unlocked( { :test => [ 'bla:blas:1233' ]} )).must_equal false + _(lock.coordinates).must_equal ['huffle:puffle:321'] + _(lock.coordinates( :test )).must_equal ['bla:blas:123'] end end diff --git a/spec/dsl/profile_gemspec_spec.rb b/spec/dsl/profile_gemspec_spec.rb index bd31657..10b495d 100644 --- a/spec/dsl/profile_gemspec_spec.rb +++ b/spec/dsl/profile_gemspec_spec.rb @@ -34,7 +34,7 @@ def self.read( name, artifact_id, version = '1.0.5' ) Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) v = Maven::Tools::VERSION v += '-SNAPSHOT' if v =~ /.dev$/ - xml.must_equal( ProfileGemspecFile.read( 'maven-tools.xml', 'maven-tools', + _(xml).must_equal( ProfileGemspecFile.read( 'maven-tools.xml', 'maven-tools', v ) ) end @@ -42,28 +42,28 @@ def self.read( name, artifact_id, version = '1.0.5' ) subject.new parent, 'maven-tools.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( ProfileGemspecFile.read( 'maven-tools.xml', 'profile_gemspec_spec' ) ) + _(xml).must_equal( ProfileGemspecFile.read( 'maven-tools.xml', 'profile_gemspec_spec' ) ) end it 'evals maven_tools.gemspec from yaml no gem dependencies' do subject.new parent, 'maven-tools.gemspec', :no_gems => true xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( ProfileGemspecFile.read( 'no_gems.xml', 'gemspec_spec' ) ) + _(xml).must_equal( ProfileGemspecFile.read( 'no_gems.xml', 'gemspec_spec' ) ) end it 'evals snapshot.gemspec' do subject.new parent, 'snapshot.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( ProfileGemspecFile.read( 'snapshot.xml', 'snapshot', '1.a-SNAPSHOT' ) ) + _(xml).must_equal( ProfileGemspecFile.read( 'snapshot.xml', 'snapshot', '1.a-SNAPSHOT' ) ) 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( ProfileGemspecFile.read( 'jars_and_poms.xml', + _(xml).must_equal( ProfileGemspecFile.read( 'jars_and_poms.xml', 'gemspec_spec' ) ) end @@ -71,7 +71,7 @@ def self.read( name, artifact_id, version = '1.0.5' ) subject.new parent, :name => 'jars_and_poms.gemspec', :include_jars => true xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( ProfileGemspecFile.read( 'jars_and_poms_include_jars.xml', + _(xml).must_equal( ProfileGemspecFile.read( 'jars_and_poms_include_jars.xml', 'gemspec_spec' ) ) end @@ -79,6 +79,6 @@ def self.read( name, artifact_id, version = '1.0.5' ) subject.new parent, 'unknown_license.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( ProfileGemspecFile.read( 'unknown_license.xml', 'gemspec_spec' ) ) + _(xml).must_equal( ProfileGemspecFile.read( 'unknown_license.xml', 'gemspec_spec' ) ) end end diff --git a/spec/dsl/project_gemspec_spec.rb b/spec/dsl/project_gemspec_spec.rb index 20a1bdc..cd46fc8 100644 --- a/spec/dsl/project_gemspec_spec.rb +++ b/spec/dsl/project_gemspec_spec.rb @@ -34,7 +34,7 @@ def self.read( name, artifact_id, version = '1.0.5' ) Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) v = Maven::Tools::VERSION v += '-SNAPSHOT' if v =~ /.[[:alpha:]][[:alnum:]]*$/ - xml.must_equal( XmlFile.read( 'maven-tools.xml', 'maven-tools', + _(xml).must_equal( XmlFile.read( 'maven-tools.xml', 'maven-tools', v ) ) end @@ -42,35 +42,35 @@ def self.read( name, artifact_id, version = '1.0.5' ) subject.new parent, 'maven-tools.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'maven-tools.xml', 'gemspec_spec' ) ) + _(xml).must_equal( XmlFile.read( 'maven-tools.xml', 'gemspec_spec' ) ) end it 'evals maven_tools.gemspec from yaml with profile' do subject.new parent, 'maven-tools.gemspec', :profile => :hidden xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'profile.xml', 'gemspec_spec' ) ) + _(xml).must_equal( XmlFile.read( 'profile.xml', 'gemspec_spec' ) ) end it 'evals maven_tools.gemspec from yaml no gem dependencies' do subject.new parent, 'maven-tools.gemspec', :no_gems => true xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'no_gems.xml', 'gemspec_spec' ) ) + _(xml).must_equal( XmlFile.read( 'no_gems.xml', 'gemspec_spec' ) ) end it 'evals snapshot.gemspec' do subject.new parent, 'snapshot.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'snapshot.xml', 'snapshot', '1.a-SNAPSHOT' ) ) + _(xml).must_equal( XmlFile.read( 'snapshot.xml', 'snapshot', '1.a-SNAPSHOT' ) ) 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( XmlFile.read( 'jars_and_poms.xml', + _(xml).must_equal( XmlFile.read( 'jars_and_poms.xml', 'gemspec_spec' ) ) end @@ -78,7 +78,7 @@ def self.read( name, artifact_id, version = '1.0.5' ) subject.new parent, :name => 'jars_and_poms.gemspec', :include_jars => true xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'jars_and_poms_include_jars.xml', + _(xml).must_equal( XmlFile.read( 'jars_and_poms_include_jars.xml', 'gemspec_spec' ) ) end @@ -91,7 +91,7 @@ def repo( url ) subject.new parent, :name => 'extended.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'extended.xml', + _(xml).must_equal( XmlFile.read( 'extended.xml', 'gemspec_spec' ) ) end @@ -99,6 +99,6 @@ def repo( url ) subject.new parent, :name => 'unknown_license.gemspec' xml = "" Maven::Tools::Visitor.new( xml ).accept_project( parent.model ) - xml.must_equal( XmlFile.read( 'unknown_license.xml', 'gemspec_spec') ) + _(xml).must_equal( XmlFile.read( 'unknown_license.xml', 'gemspec_spec') ) end end diff --git a/spec/gemspec_dependencies_spec.rb b/spec/gemspec_dependencies_spec.rb index 138dfc0..59cbc30 100644 --- a/spec/gemspec_dependencies_spec.rb +++ b/spec/gemspec_dependencies_spec.rb @@ -25,9 +25,9 @@ subject { Maven::Tools::GemspecDependencies.new( spec ) } it 'should setup artifact' do - subject.runtime.must_equal ["rubygems:thor:[0.14.6,2.0)", "rubygems:maven-tools:[0.32.3,0.32.99999]"] - subject.development.must_equal ["rubygems:minitest:[5.3,5.99999]", "rubygems:rake:[10.0,10.99999]"] - subject.java_runtime.must_equal [ ["sdas", "das", "jar", "tes", "123"], + _(subject.runtime).must_equal ["rubygems:thor:[0.14.6,2.0)", "rubygems:maven-tools:[0.32.3,0.32.99999]"] + _(subject.development).must_equal ["rubygems:minitest:[5.3,5.99999]", "rubygems:rake:[10.0,10.99999]"] + _(subject.java_runtime).must_equal [ ["sdas", "das", "jar", "tes", "123"], ["sdas", "das", "jar", "123"], ["sdas.asd", "das", "jar", "123", ["fds:fre"]], ["sdas.asd", "das", "jar", "bla", "123", ["fds:fre", "ferf:de"]], @@ -37,7 +37,7 @@ ["de.sdas.asd", "das", "jar", "123", ["fds:fre"]], ["de.sdas.asd", "das", "jar", "bla", "123", ["fds:fre", "ferf:de"]], ["de.sdas.asd", "das", "jar", "blub", "123", ["fds:fre","ferf:de"]] ] - subject.java_dependencies.must_equal [ [:compile, "sdas", "das", "jar", "tes", "123"], + _(subject.java_dependencies).must_equal [ [:compile, "sdas", "das", "jar", "tes", "123"], [:compile, "sdas", "das", "jar", "123"], [:compile, "sdas.asd", "das", "jar", "123", ["fds:fre"]], [:compile, "sdas.asd", "das", "jar", "bla", "123", ["fds:fre", "ferf:de"]], diff --git a/spec/jarfile_spec.rb b/spec/jarfile_spec.rb index c488622..1bfdff0 100644 --- a/spec/jarfile_spec.rb +++ b/spec/jarfile_spec.rb @@ -38,7 +38,7 @@ def add_repository(name, url) it 'generates lockfile' do subject.generate_lockfile(%w( a b c d e f ruby.bundler:bla)) - File.read(jfile_lock).must_equal <<-EOF + _(File.read(jfile_lock)).must_equal <<-EOF a b c @@ -55,10 +55,10 @@ def add_repository(name, url) a:c:jar:1 EOF end - subject.locked.must_equal ["a:b:pom:3", "a:c:jar:1"] - subject.locked?("a:b:pom:321").must_equal true - subject.locked?("a:b:jar:321").must_equal true - subject.locked?("a:d:jar:432").must_equal false + _(subject.locked).must_equal ["a:b:pom:3", "a:c:jar:1"] + _(subject.locked?("a:b:pom:321")).must_equal true + _(subject.locked?("a:b:jar:321")).must_equal true + _(subject.locked?("a:d:jar:432")).must_equal false end it 'populate repositories' do @@ -70,11 +70,11 @@ def add_repository(name, url) EOF end subject.populate_unlocked container - container.repositories.size.must_equal 3 - container.artifacts.size.must_equal 0 - container.repositories[0].must_equal "first" - container.repositories[1].must_equal "second" - container.repositories[2].must_equal "http://example.org/repo/3" + _(container.repositories.size).must_equal 3 + _(container.artifacts.size).must_equal 0 + _(container.repositories[0]).must_equal "first" + _(container.repositories[1]).must_equal "second" + _(container.repositories[2]).must_equal "http://example.org/repo/3" end it 'populate artifacts without locked' do @@ -85,10 +85,10 @@ def add_repository(name, url) EOF end subject.populate_unlocked container - container.repositories.size.must_equal 0 - container.artifacts.size.must_equal 2 - container.artifacts[0].to_s.must_equal "a:b:jar:123" - container.artifacts[1].to_s.must_equal "x:y:pom:987" + _(container.repositories.size).must_equal 0 + _(container.artifacts.size).must_equal 2 + _(container.artifacts[0].to_s).must_equal "a:b:jar:123" + _(container.artifacts[1].to_s).must_equal "x:y:pom:987" end it 'populate artifacts with locked' do @@ -105,9 +105,9 @@ def add_repository(name, url) end subject.populate_unlocked container - container.repositories.size.must_equal 0 - container.artifacts.size.must_equal 1 - container.artifacts[0].to_s.must_equal "x:y:pom:987" + _(container.repositories.size).must_equal 0 + _(container.artifacts.size).must_equal 1 + _(container.artifacts[0].to_s).must_equal "x:y:pom:987" end it 'populate locked artifacts' do @@ -118,8 +118,8 @@ def add_repository(name, url) end subject.populate_locked container - container.repositories.size.must_equal 0 - container.artifacts.size.must_equal 1 - container.artifacts[0].to_s.must_equal "a:b:jar:432" + _(container.repositories.size).must_equal 0 + _(container.artifacts.size).must_equal 1 + _(container.artifacts[0].to_s).must_equal "a:b:jar:432" end end diff --git a/spec/pom_spec.rb b/spec/pom_spec.rb index 45d4d6c..575b908 100644 --- a/spec/pom_spec.rb +++ b/spec/pom_spec.rb @@ -18,7 +18,7 @@ pom_xml.gsub!( /tesla-polyglot/, 'polyglot' ) pom_xml.gsub!( /${tesla.version}/, Maven::Tools::VERSIONS[ :polyglot_version ] ) - pom.to_s.must_equal pom_xml + _(pom.to_s).must_equal pom_xml end end end