spec/integration/file_upload_spec.rb in rmega-0.1.4 vs spec/integration/file_upload_spec.rb in rmega-0.1.5

- old
+ new

@@ -55,26 +55,24 @@ @buffer = "rofl" * 1024 File.open(@path, 'wb') do |f| 512.times { f.write(@buffer) } end + + @folder = @storage.root.create_folder(@name) + @folder.upload(@path) end - let!(:folder) { @storage.root.create_folder(@name) } - - # TODO: `let` and `subject` declarations are not intended to be called in a `before(:all)` - before(:all) { folder.upload(@path) } - it 'finds the uploaded file and verify its content' do - file = folder.files.find { |f| f.name == @name } + file = @folder.files.find { |f| f.name == @name } download_path = "#{@path}.downloaded" file.download(download_path) File.open(download_path, 'rb') do |f| 512.times { expect(f.read(@buffer.size)).to eq(@buffer) } end end - after { folder.delete } + after { @folder.delete if @folder } end end end