Sha256: ffed9909f03caf3dc5f16160b8c1756c1bcb5eda72d4f0ca8719eed05ed082c0

Contents?: true

Size: 1.38 KB

Versions: 12

Compression:

Stored size: 1.38 KB

Contents

# -*- encoding: utf-8 -*-
require 'helper'

describe Octokit::Client::Contents do

  before do
    @client = Octokit::Client.new(:login => 'sferik')
  end

  describe ".readme" do

    it "should return the default readme" do
      stub_get("/repos/pengwynn/octokit/readme").
        to_return(:body => fixture("v3/readme.json"))
      readme = @client.readme('pengwynn/octokit')
      readme.encoding.should == "base64"
      readme.type.should == "file"
    end

  end

  describe ".contents" do

    it "should return the contents of a file" do
      stub_get("/repos/pengwynn/octokit/contents/lib/octokit.rb").
        to_return(:body => fixture("v3/contents.json"))
      contents = @client.contents('pengwynn/octokit', :path => "lib/octokit.rb")
      contents.path.should == "lib/octokit.rb"
      contents.name.should == "lib/octokit.rb"
      contents.encoding.should == "base64"
      contents.type.should == "file"
    end

  end

  describe ".archive_link" do

    it "should return the headers of the request" do
      stub_get("/repos/pengwynn/octokit/tarball/master").
        to_return(:status => 302, :body => '', :headers =>
          { 'location' => "https://nodeload.github.com/repos/pengwynn/octokit/tarball/"})
      archive_link = @client.archive_link('pengwynn/octokit', :ref => "master")
      archive_link == "https://nodeload.github.com/pengwynn/octokit/tarball/"
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
octokit-1.17.0 spec/octokit/client/contents_spec.rb
octokit-1.15.1 spec/octokit/client/contents_spec.rb
octokit-1.15.0 spec/octokit/client/contents_spec.rb
octokit-1.14.0 spec/octokit/client/contents_spec.rb
octokit-1.13.0 spec/octokit/client/contents_spec.rb
octokit-1.12.0 spec/octokit/client/contents_spec.rb
octokit-1.11.0 spec/octokit/client/contents_spec.rb
octokit-1.10.0 spec/octokit/client/contents_spec.rb
octokit-1.9.4 spec/octokit/client/contents_spec.rb
octokit-1.9.3 spec/octokit/client/contents_spec.rb
octokit-1.9.2 spec/octokit/client/contents_spec.rb
octokit-1.9.1 spec/octokit/client/contents_spec.rb