Skip to content

Commit

Permalink
Fix: Use correct HTTP verb for project enable
Browse files Browse the repository at this point in the history
- Use POST instead of DELETE to enable project
- Re-record correct interactions
  • Loading branch information
mtchavez committed Sep 14, 2016
1 parent afb95a5 commit efd8b7e
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
circleci (0.2.3)
circleci (1.0.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -105,4 +105,4 @@ DEPENDENCIES
yard (~> 0.9.5, >= 0.9.5)

BUNDLED WITH
1.12.5
1.13.0
2 changes: 1 addition & 1 deletion lib/circleci/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def self.delete_checkout_key(username, project, fingerprint)
# @param project [String] - Name of project
# @return [CircleCi::Response] - Response object
def self.enable(username, project)
CircleCi.request("/project/#{username}/#{project}/enable").delete
CircleCi.request("/project/#{username}/#{project}/enable").post
end

##
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions spec/circleci/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,20 +393,21 @@

describe 'enable' do
context 'successfully' do
let(:res) { described_class.enable 'mtchavez', 'circleci' }
let(:res) { described_class.enable 'mtchavez', 'dotfiles' }

it 'is verified by response' do
expect(res).to be_instance_of(CircleCi::Response)
expect(res).to be_success
end

describe 'project' do
let(:res) { described_class.list_checkout_keys 'mtchavez', 'dotfiles' }
subject { res.body }

it 'returns the circleci project settings' do
expect(subject).to be_instance_of(Hash)
expect(subject['ssh_keys']).not_to be_empty
expect(subject).to have_key 'branches'
expect(subject).to be_instance_of(Array)
expect(subject.first).to have_key('public_key')
expect(subject.first['type']).to eql('deploy-key')
end
end
end
Expand Down

0 comments on commit efd8b7e

Please sign in to comment.