Sha256: bb51bd574a9783c03c5486608d531f06cfe8919b9c96b86209778a8a84493eed

Contents?: true

Size: 942 Bytes

Versions: 14

Compression:

Stored size: 942 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos::Contents, '#get' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:path) { 'README.md' }
  let(:request_path) { "/repos/#{user}/#{repo}/contents/#{path}" }

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

  after { reset_authentication_for(subject) }

  let(:path) { 'README.md' }
  let(:body) { fixture('repos/content.json') }
  let(:status) { 200 }

  it { expect { subject.get user, repo }.to raise_error(ArgumentError) }

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

  it "should get the resources" do
    subject.get user, repo, path
    a_get(request_path).should have_been_made
  end

  it "should get repository information" do
    content = subject.get user, repo, path
    content.name.should == 'README.md'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/repos/contents/get_spec.rb
github_api-0.11.2 spec/github/repos/contents/get_spec.rb
github_api-0.11.1 spec/github/repos/contents/get_spec.rb
github_api-0.11.0 spec/github/repos/contents/get_spec.rb
github_api-0.10.2 spec/github/repos/contents/get_spec.rb
github_api-0.10.1 spec/github/repos/contents/get_spec.rb
github_api-0.10.0 spec/github/repos/contents/get_spec.rb
github_api-0.9.7 spec/github/repos/contents/get_spec.rb
github_api-0.9.6 spec/github/repos/contents/get_spec.rb
github_api-0.9.5 spec/github/repos/contents/get_spec.rb
github_api-0.9.4 spec/github/repos/contents/get_spec.rb
github_api-0.9.3 spec/github/repos/contents/get_spec.rb
github_api-0.9.2 spec/github/repos/contents/get_spec.rb
github_api-0.9.1 spec/github/repos/contents/get_spec.rb