spec/sprinkle/installers/source_spec.rb in sprinkle-0.2.6 vs spec/sprinkle/installers/source_spec.rb in sprinkle-0.3.0

- old
+ new

@@ -23,10 +23,12 @@ enable %w( headers ssl deflate so ) disable %w( cache proxy rewrite ) with %w( debug extras ) without %w( fancyisms ) + + option %w( foo bar baz ) end @installer.defaults(@deployment) end @@ -84,10 +86,14 @@ it 'should support specification of "without" options' do @installer.without.should == %w( fancyisms ) end + it 'should support specification of "option" options' do + @installer.option.should == %w( foo bar baz ) + end + it 'should support customized build area' do @installer.prefix.should == '/usr/local' end it 'should support customized source area' do @@ -338,8 +344,28 @@ after do @installer.send(:extract_command).should == @extraction end + end + + describe 'base dir calculation' do + + %w( tar tar.gz tgz tar.bz2 tb2 zip ).each do |archive| + + it "should recognize #{archive} style archives" do + @installer.source = "blah.#{archive}" + @installer.send(:base_dir).should == 'blah' + end + + end + + # def base_dir #:nodoc: + # if archive_name.split('/').last =~ /(.*)\.(tar\.gz|tgz|tar\.bz2|tar|tb2)/ + # return $1 + # end + # raise "Unknown base path for source archive: #{@source}, please update code knowledge" + # end + end end