spec/config_spec.rb in jbundler-0.8.0 vs spec/config_spec.rb in jbundler-0.9.0

- old
+ new

@@ -2,11 +2,11 @@ require 'jbundler/config' require 'fileutils' describe JBundler::Config do - let( :basedir ){ File.dirname( File.dirname( File.expand_path( __FILE__ ) ) ) } + let( :basedir ){ File.dirname( File.expand_path( "../", __FILE__ ) ) } let( :spec ){ 'spec' } let( :spec_dir ){ File.join( basedir, spec ) } let( :project ){ File.join( spec, 'project' ) } let( :project_dir ) { File.join( basedir, project ) } @@ -30,17 +30,17 @@ FileUtils.cd( 'spec' ) do c = JBundler::Config.new c.verbose.must_equal nil c.local_repository.must_equal './.m2/repository' - c.jarfile.must_equal File.join( basedir, 'Jarfile' ) - c.gemfile.must_equal File.join( basedir, 'Gemfile' ) + c.jarfile.must_equal File.join( basedir, 'spec', 'Jarfile' ) + c.gemfile.must_equal File.join( basedir, 'spec', 'Gemfile' ) c.skip.must_equal nil c.settings.must_equal "./.m2/settings.xml" c.offline.must_equal false - c.work_dir.must_equal File.join( basedir, 'pkg' ) - c.vendor_dir.must_equal File.join( basedir, 'vendor/jars' ) + c.work_dir.must_equal File.join( basedir, 'spec','pkg' ) + c.vendor_dir.must_equal File.join( basedir, 'spec', 'vendor', 'jars' ) end end it 'has following defaults without home and with local config' do ENV['HOME'] = '.' @@ -57,24 +57,24 @@ c.vendor_dir.must_equal File.join( project_dir, 'vendor/myjars' ) end end it 'has following defaults with home and without local config' do - ENV['HOME'] = File.join( 'home' ) + home = ENV['HOME'] = File.join( File.expand_path( '../home', __FILE__ ) ) - FileUtils.cd( spec ) do + FileUtils.cd( home ) do c = JBundler::Config.new - + c.verbose.must_equal false - c.local_repository.must_equal File.join( spec_dir, 'localrepo' ) - c.jarfile.must_equal File.join( spec_dir, 'jarfile' ) - c.gemfile.must_equal File.join( spec_dir, 'Gem_file' ) + c.local_repository.must_equal File.join( spec_dir, 'home', 'localrepo' ) + c.jarfile.must_equal File.join( spec_dir, 'home', 'jarfile' ) + c.gemfile.must_equal File.join( spec_dir, 'home', 'Gem_file' ) c.skip.must_equal true - c.settings.must_equal File.join( spec_dir, 'Settings.xml' ) + c.settings.must_equal nil c.offline.must_equal false - c.work_dir.must_equal File.join( spec_dir, 'target/pkg' ) - c.vendor_dir.must_equal File.join( spec_dir, 'vendor/my_jars' ) + c.work_dir.must_equal File.join( spec_dir, 'home', 'target/pkg' ) + c.vendor_dir.must_equal File.join( spec_dir, 'home', 'vendor/my_jars' ) end end it 'has following defaults with home and with local config' do ENV['HOME'] = File.expand_path( File.join( 'spec', 'home' ) ) @@ -127,10 +127,9 @@ [ 'spec', 'spec/project' ].each do |dir| it "uses ENV with home #{home} and local dir #{dir}" do ENV['HOME'] = eval "\"#{File.expand_path( home )}\"" - FileUtils.cd eval "\"#{dir}\"" do pdir = eval "#{File.basename( dir )}_dir" Jars.reset c = JBundler::Config.new c.verbose.must_equal true