Sha256: c2aa14c6d7afc5404fdd3b78b2a019e24227dac87b5b484cc9d53f777c653caa

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 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

2 entries across 2 versions & 1 rubygems

Version Path
octokit-1.8.1 spec/octokit/client/contents_spec.rb
octokit-1.8.0 spec/octokit/client/contents_spec.rb