Skip to content

Commit

Permalink
Backups: create_backup added
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaV committed Oct 28, 2016
1 parent 076460f commit 5e5ee29
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/vscale/api/backups.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Vscale
module Backups
def create_backup(scalet_id)
post("#{scalet_id}/backup")
end

def backups
get('backups')
end
Expand All @@ -8,8 +12,8 @@ def backup(id)
get("backups/#{id}")
end

def delete_backup(backup_id)
delete("backups/#{backup_id}")
def delete_backup(backup_id, params)
delete("backups/#{backup_id}", params)
end
end
end
9 changes: 9 additions & 0 deletions spec/api/backups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@
@api.delete_backup backup_id
end
end

describe '#create_backup' do
it 'calls #post with the correct url and params' do
scalet_id = 98
params = { :name => "My Backup" }
@api.should_receive(:post).with('98/backup', params)
@api.create_backup scalet_id, params
end
end
end

0 comments on commit 5e5ee29

Please sign in to comment.