Sha256: bc0baf53bdb43b66bc86c485425c71231c871475288b93e09f85dd1410704ab3

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Client::Repos::Releases::Assets, '#list' do
  let(:owner) { 'peter-murach' }
  let(:repo)  { 'github' }
  let(:id)    { 1 }
  let(:path)  { "/repos/#{owner}/#{repo}/releases/#{id}/assets" }

  before {
    stub_get(path).to_return(body: body, status: status,
      headers: {content_type: 'application/json; charset=utf-8'})
  }

  after { reset_authentication_for(subject) }

  context "resource found" do
    let(:body)   { fixture("repos/assets.json") }
    let(:status) { 200 }

    it { should respond_to :all }

    it { expect { subject.list }.to raise_error(ArgumentError) }

    it "should fail to get resource without repository" do
      expect { subject.list owner }.to raise_error(ArgumentError)
    end

    it "should get the resources" do
      subject.list owner, repo, id
      expect(a_get(path)).to have_been_made
    end

    it_should_behave_like 'an array of resources' do
      let(:requestable) { subject.list owner, repo, id }
    end

    it "should get asset information" do
      assets = subject.list owner, repo, id
      expect(assets.first.name).to eq 'example.zip'
    end

    it "should yield to a block" do
      yielded = []
      result = subject.list(owner, repo, id) { |obj| yielded << obj }
      expect(yielded).to eq result
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.list owner, repo, id }
  end
end # list

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_api-0.12.3 spec/github/client/repos/assets/list_spec.rb
github_api-0.12.2 spec/github/client/repos/assets/list_spec.rb
github_api-0.12.1 spec/github/client/repos/assets/list_spec.rb
github_api-0.12.0 spec/github/client/repos/assets/list_spec.rb