Sha256: 5538aa11a48ae3fae52b8541386638780a31d00e21a77beeace7a904a8c77bba
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
# -*- coding: utf-8 -*- require "sixarm_ruby_blob_test" describe Blob do DIR = Pathname(__FILE__).dirname + "samples" BASE = "upload_output.bin" TEMPFILE_PATH = DIR + "upload_input.bin" TEMPFILE_BINMODE = true let(:blob){ Blob.new(dir: DIR, base: BASE) } let(:original_filename){ "hello" } let(:content_type){ "abc/def" } # Mocks let(:tempfile){ OpenStruct.new(path: TEMPFILE_PATH, binmode: TEMPFILE_BINMODE) } let(:file_field){ OpenStruct.new(content_type: content_type, original_filename: original_filename, tempfile: tempfile) } describe "upload" do before do @file_path = blob.file_path # Delete a previously-uploaded file if it exists File.exist?(@file_path) and File.delete(@file_path) # Sanity check File.exist?(tempfile.path).must_be_true "Temp file must exist: #{tempfile.path}" end describe ".upload" do it "uploads" do File.exist?(@file_path).must_be_false "Blob file must not exist: #{@file_path}" blob.upload(file_field).must_be_true File.exist?(@file_path).must_be_true "Blob file must exist: #{@file_path}" end end describe "#upload" do it "uploads" do File.exist?(@file_path).must_be_false "Blob file must not exist: #{@file_path}" Blob.upload(@file_path, file_field).must_be_true File.exist?(@file_path).must_be_true "Blob file must exist: #{@file_path}" end end describe "#vet_file_field" do before do # Sanity check file_field.must_exist file_field.must_respond_to :tempfile file_field.tempfile.must_be_exist file_field.tempfile.must_respond_to :path file_field.tempfile.must_respond_to :binmode file_field.tempfile.path.must_exist end it "vets" do Blob.vet_file_field?(file_field).must_be_true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sixarm_ruby_blob-2.0.0 | test/sixarm_ruby_blob_test/upload_test.rb |