lib/aranha/fixtures/download.rb in aranha-0.11.2 vs lib/aranha/fixtures/download.rb in aranha-0.12.0
- old
+ new
@@ -42,10 +42,12 @@
Rails.root.to_s
end
def download(url, target)
Rails.logger.info "Baixando \"#{url}\"..."
- File.open(target, 'wb') { |file| file.write(::Aranha::Parsers::Base.new(url).content) }
+ content = ::Aranha::Parsers::Base.new(url).content
+ raise "Content is blank for \"#{url}\"" if content.blank?
+ File.open(target, 'wb') { |file| file.write(content) }
end
def url(file)
::Aranha::Parsers::SourceAddress.from_file(file)
end