Skip to content

Commit

Permalink
Changed the spec fix to retain the 'https' prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbishop-fiksu committed Nov 10, 2014
1 parent 7826c87 commit fcbf0ac
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions spec/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,69 +109,69 @@ module Downloader
#-------------------------------------------------------------------------#

it 'detects zip files' do
options = { :http => 'file:///file.zip' }
options = { :http => 'https://foo/file.zip' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :zip
end

it 'detects tar files' do
options = { :http => 'file:///file.tar' }
options = { :http => 'https://foo/file.tar' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :tar
end

it 'detects tgz files' do
options = { :http => 'file:///file.tgz' }
options = { :http => 'https://foo/file.tgz' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :tgz
end

it 'detects tbz files' do
options = { :http => 'file:///file.tbz' }
options = { :http => 'https://foo/file.tbz' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :tbz
end

it 'detects txz files' do
options = { :http => 'file:///file.txz' }
options = { :http => 'https://foo/file.txz' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :txz
end

it 'allows to specify the file type in the sources' do
options = { :http => 'file:///file', :type => :zip }
options = { :http => 'https://foo/file', :type => :zip }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :zip
end

it 'should download file and extract it with proper type' do
options = { :http => 'file:///file.zip' }
options = { :http => 'https://foo/file.zip' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.expects(:download_file).with(anything)
downloader.expects(:extract_with_type).with(anything, :zip).at_least_once
downloader.download
end

it 'should raise error when an unsupported file type is detected' do
options = { :http => 'file:///file.rar' }
options = { :http => 'https://foo/file.rar' }
downloader = Downloader.for_target(tmp_folder, options)
lambda { downloader.download }.should.raise Http::UnsupportedFileTypeError
end

it 'should raise error when an unsupported file type is specified in the options' do
options = { :http => 'file:///file', :type => :rar }
options = { :http => 'https://foo/file', :type => :rar }
downloader = Downloader.for_target(tmp_folder, options)
lambda { downloader.download }.should.raise Http::UnsupportedFileTypeError
end

it 'detects the file type if specified with a string' do
options = { :http => 'file:///file', :type => 'zip' }
options = { :http => 'https://foo/file', :type => 'zip' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :zip
end

it 'returns whether it does not supports the download of the head' do
options = { :http => 'file:///file', :type => 'zip' }
options = { :http => 'https://foo/file', :type => 'zip' }
downloader = Downloader.for_target(tmp_folder('checkout'), options)
downloader.head_supported?.should.be.false
end
Expand Down

0 comments on commit fcbf0ac

Please sign in to comment.