mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 10:59:08 +01:00
Add test for trying to delete account while an export is pending
This commit is contained in:
parent
c59a70844b
commit
f396167704
1 changed files with 25 additions and 0 deletions
25
spec/requests/user/registrations_controller_spec.rb
Normal file
25
spec/requests/user/registrations_controller_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe User::RegistrationsController, type: :controller do
|
||||||
|
let(:user) { FactoryBot.create(:user, **user_params) }
|
||||||
|
|
||||||
|
describe "DELETE #destroy" do
|
||||||
|
subject { delete :destroy }
|
||||||
|
|
||||||
|
context "user has an export pending" do
|
||||||
|
let(:user_params) { { export_processing: true } }
|
||||||
|
|
||||||
|
before do
|
||||||
|
@request.env["devise.mapping"] = Devise.mappings[:user] # so that devise knows that we're testing the user controller
|
||||||
|
sign_in(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't allow for the account to be deleted" do
|
||||||
|
subject
|
||||||
|
expect(flash[:error]).to eq(I18n.t("user.registrations.destroy.export_pending"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue