Sha256: fb536210cec593de1edc92ffecd28ad164841851d10598fe2b58d737201a8a69

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require 'rack/test'

describe Happi::File do
  context "with a file name" do
    subject { Happi::File.new(__FILE__) }

    describe '#encode_file' do
      encoded = Base64.encode64(File.read(__FILE__))
      specify { expect(subject.encode_file).to eql(encoded) }
    end

    describe '#mime_type' do
      specify { expect(subject.mime_type).to eql('application/x-ruby') }
    end

    describe '#multipart' do
      # specify { expect(subject.multipart).to }
    end

    describe '#exists?' do
      specify { expect(subject.exists?).to eq(true) }
    end
  end

  context "with an ActionDispatch::Http::UploadedFile" do
    subject { Happi::File.new(Rack::Test::UploadedFile.new(__FILE__, 'application/x-ruby')) }

    describe '#encode_file' do
      encoded = Base64.encode64(File.read(__FILE__))
      specify { expect(subject.encode_file).to eql(encoded) }
    end

    describe '#mime_type' do
      specify { expect(subject.mime_type).to eql('application/x-ruby') }
    end

    describe '#multipart' do
      # specify { expect(subject.multipart).to }
    end

    describe '#exists?' do
      specify { expect(subject.exists?).to eq(true) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
happi-0.2.0 spec/file_spec.rb
happi-0.1.0 spec/file_spec.rb
happi-0.0.12 spec/file_spec.rb
happi-0.0.11 spec/file_spec.rb
happi-0.0.10 spec/file_spec.rb