Sha256: 203f6b0241f746e4895a7d10fc7afaaf29ee8642b7607ce8eab1088d6b3c5c67

Contents?: true

Size: 897 Bytes

Versions: 24

Compression:

Stored size: 897 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'github_api/s3_uploader'

describe Github::Repos::Downloads do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }

  after { reset_authentication_for(subject) }

  let(:resource) { stub(:resource) }
  let(:filename) { 'filename' }
  let(:res)      { stub(:response, :body => 'success') }
  let(:uploader) { stub(:uploader, :send => res) }

  before { Github::S3Uploader.stub(:new) { uploader } }

  it "should fail if resource is of incorrect type" do
    expect {
      subject.upload resource, nil
    }.to raise_error(ArgumentError)
  end

  it "should upload resource successfully" do
    res = stub(:response, :body => 'success')
    uploader = stub(:uploader, :send => res)
    Github::S3Uploader.should_receive(:new).with(resource, filename) { uploader }
    subject.upload(resource, filename).should == 'success'
  end
end # upload

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
github_api-0.10.2 spec/github/repos/downloads/upload_spec.rb
github_api-0.10.1 spec/github/repos/downloads/upload_spec.rb
github_api-0.10.0 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.7 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.6 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.5 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.4 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.3 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.2 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.1 spec/github/repos/downloads/upload_spec.rb
github_api-0.9.0 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.11 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.10 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.9 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.8 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.7 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.6 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.5 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.4 spec/github/repos/downloads/upload_spec.rb
github_api-0.8.3 spec/github/repos/downloads/upload_spec.rb