2017-03-22 21:29:35 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-08-23 22:01:11 -05:00
|
|
|
RSpec.describe Admin::BackupsController do
|
2017-03-22 21:29:35 -05:00
|
|
|
let(:admin) { Fabricate(:admin) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2017-08-23 22:01:11 -05:00
|
|
|
describe '#rollback' do
|
2017-03-22 21:29:35 -05:00
|
|
|
it 'should rollback the restore' do
|
|
|
|
BackupRestore.expects(:rollback!)
|
|
|
|
|
|
|
|
post "/admin/backups/rollback.json"
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not allow rollback via a GET request' do
|
|
|
|
expect { get "/admin/backups/rollback.json" }
|
|
|
|
.to raise_error(ActionController::RoutingError)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-23 22:01:11 -05:00
|
|
|
describe '#cancel' do
|
2017-03-22 21:29:35 -05:00
|
|
|
it "should cancel an backup" do
|
|
|
|
BackupRestore.expects(:cancel!)
|
|
|
|
|
|
|
|
delete "/admin/backups/cancel.json"
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not allow cancel via a GET request' do
|
|
|
|
expect { get "/admin/backups/cancel.json" }
|
|
|
|
.to raise_error(ActionController::RoutingError)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|