-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51524e0
commit a84ada2
Showing
11 changed files
with
151 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/views/admin/account_requests/_close_admin_modal.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<div class="modal" id="close-modal"> | ||
<div class="modal-dialog"> | ||
|
||
<!-- Modal content--> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title"> | ||
Close Account Request | ||
</h4> | ||
<button type="button" class="close btn-close" data-bs-dismiss="modal">×</button> | ||
</div> | ||
<div class="modal-body"> | ||
<%= simple_form_for AccountRequest.new, url: close_admin_account_requests_path, method: :post do |f| %> | ||
<%= f.hidden_field :id, id: :reject_account_request_id %> | ||
<div class="form-inputs"> | ||
<%= f.input :rejection_reason, required: true, autofocus: true, wrapper: :input_group %> | ||
</div> | ||
<%= submit_button %> | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
spec/controllers/admin/account_requests_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
RSpec.describe Admin::AccountRequestsController, type: :controller do | ||
before do | ||
sign_in(create(:super_admin, organization: nil)) | ||
end | ||
|
||
let(:account_request) { create(:account_request) } | ||
let(:rejection_params) do | ||
{ | ||
account_request: { | ||
id: account_request.id, | ||
rejection_reason: "some rejection reason" | ||
} | ||
} | ||
end | ||
|
||
describe "POST #reject" do | ||
it "should reject the account request" do | ||
post :reject, params: rejection_params | ||
expect(account_request.reload).to be_rejected | ||
expect(flash[:notice]).to eq("Account request rejected!") | ||
expect(response).to redirect_to(admin_account_requests_path) | ||
end | ||
end | ||
|
||
describe "POST #close" do | ||
it "should close the account request" do | ||
post :close, params: rejection_params | ||
expect(account_request.reload).to be_admin_closed | ||
expect(flash[:notice]).to eq("Account request closed!") | ||
expect(response).to redirect_to(admin_account_requests_path) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters