Sha256: 88ff4c6cc760bd2f932620e23ebbf1785b24d8d2cca965909cac142fd21e04ad

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 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 { expect {subject.edit user, repo }.to raise_error(ArgumentError) }

    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

14 entries across 14 versions & 1 rubygems

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