Migrate old specs

pull/16084/head
Alberto Miedes Garcés 4 years ago
parent 69c8a15ee9
commit eacfbf7d8c

@ -457,6 +457,19 @@ describe CentralUserCommands do
expect(user.reload).to be_present
expect(shared_table.reload).to be_present
end
context 'when the force flag is set' do
let(:user_params) { { id: user_id, force: true } }
before do
notifications_topic.stubs(:publish)
central_user_commands.delete_user(message)
end
it 'deletes the user' do
expect(Carto::User.exists?(id: user_id)).to eq(false)
end
end
end
context 'when the user belongs to an organization and has access to shared entities' do

@ -291,31 +291,4 @@ describe Carto::Superadmin::UsersController do
end
end
end
describe '#destroy' do
before(:all) do
@user = FactoryGirl.create(:carto_user)
end
after(:all) do
@user.destroy
end
it 'should return specific error when user has related entities' do
User.any_instance.stubs(:destroy).raises(CartoDB::SharedEntitiesError, 'Cannot delete user, has shared entities')
delete_json(superadmin_user_url(@user), {}, superadmin_headers) do |response|
response.status.should eq 422
response.body[:errorCode].should eq 'userHasSharedEntities'
end
User.any_instance.unstub(:destroy)
end
it 'should remove user with shared entities if force is present' do
User.any_instance.stubs(:has_shared_entities?).returns(true)
delete_json(superadmin_user_url(@user), { force: true }, superadmin_headers) do |response|
response.status.should eq 204
end
User.any_instance.unstub(:has_shared_entities?)
end
end
end

Loading…
Cancel
Save