Sha256: ff5dec6c13968f6ddcbd2f8aab176ae9a0a5cd050def8eb36f963513ae38c09a

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos::Keys, '#edit' do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/repos/#{user}/#{repo}/keys/#{key_id}" }
  let(:key_id) { 1 }
  let(:inputs) { {:title => "octocat@octomac", :key => "ssh-rsa AAA..." } }

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

  after { reset_authentication_for(subject) }

  context "resource edited successfully" do
    let(:body) { fixture("repos/key.json") }
    let(:status) { 200 }

    it "should edit the resource" do
      subject.edit user, repo, key_id, inputs
      a_patch(request_path).should have_been_made
    end

    it "should get the key information back" do
      key = subject.edit user, repo, key_id, inputs
      key.id.should == key_id
      key.title.should == 'octocat@octomac'
    end
  end

  it_should_behave_like 'request failure' do
    let(:requestable) { subject.edit user, repo, key_id, inputs }
  end

end # edit

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/repos/keys/edit_spec.rb
github_api-0.8.11 spec/github/repos/keys/edit_spec.rb
github_api-0.8.10 spec/github/repos/keys/edit_spec.rb
github_api-0.8.9 spec/github/repos/keys/edit_spec.rb
github_api-0.8.8 spec/github/repos/keys/edit_spec.rb
github_api-0.8.7 spec/github/repos/keys/edit_spec.rb
github_api-0.8.6 spec/github/repos/keys/edit_spec.rb
github_api-0.8.5 spec/github/repos/keys/edit_spec.rb
github_api-0.8.4 spec/github/repos/keys/edit_spec.rb
github_api-0.8.3 spec/github/repos/keys/edit_spec.rb
github_api-0.8.2 spec/github/repos/keys/edit_spec.rb