Sha256: 91b9695ffdbc6bd3be3f825ec0ebe3b95700aacb0ffb2f0384eed4f82dec2459

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Repos do
  let(:user) { 'peter-murach' }
  let(:repo) { 'github' }
  let(:request_path) { "/repos/#{user}/#{repo}" }
  let(:body) { '' }
  let(:status) { 204 }

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

  after { reset_authentication_for subject }

  it { should respond_to :remove }

  it "should delete the resource successfully" do
    subject.delete user, repo
    a_delete(request_path).should have_been_made
  end

  it "should fail to delete resource without 'user' parameter" do
    expect { subject.delete nil, repo }.to raise_error(ArgumentError)
  end

  it "should fail to delete resource without 'repo' parameter" do
    expect { subject.delete user, nil }.to raise_error(ArgumentError)
  end

  context 'failed to delete' do
    let(:status) { 404 }

    it "should fail to delete resource that is not found" do
      expect {
        subject.delete user, repo
      }.to raise_error(Github::Error::NotFound)
    end
  end
end # delete

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
github_api-0.7.2 spec/github/repos/delete_spec.rb
github_api-0.7.1 spec/github/repos/delete_spec.rb