Sha256: 5f246e92fb01b4dd34b43b930d9387960e6aaa6a76393d184d224be1737577cb
Contents?: true
Size: 1.29 KB
Versions: 39
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' require 'github_api/s3_uploader' describe Github::S3Uploader do let(:result) { stub(:resource, 'path' => 'downloads/octokit/github/droid', 'acl' => 'public-read', 'name' => 'droid', "accesskeyid"=>"1DWESVTPGHQVTX38V182", "policy"=> "GlyYXRp==", "signature" => "fMGgiss1w=", "mime_type"=>"image/jpeg", "file"=> '', "s3_url" => 'https://github.s3.amazonaws.com/' ) } let(:filename) { '/Users/octokit/droid.jpg' } let(:mapped_hash) { {} } let(:uploader) { Github::S3Uploader.new result, filename } before do stub_post('https://github.s3.amazonaws.com/', ''). to_return(:body => '', :status => 201, :headers => {}) Faraday::UploadIO.stub(:new) { '' } Github::CoreExt::OrderedHash.stub(:[]) { mapped_hash } end it 'checks for missing parameters' do resource = stub(:resource) uploader = Github::S3Uploader.new resource, filename expect { uploader.send }.to raise_error(ArgumentError) end it 'serializes file' do Faraday::UploadIO.should_receive(:new) { '' } uploader.send end it 'sends request to amazon aws' do uploader.send a_post('https://github.s3.amazonaws.com/', '').with(mapped_hash). should have_been_made end end # Github::S3Uploader
Version data entries
39 entries across 39 versions & 1 rubygems