Skip to content

Commit

Permalink
Permit the sender_comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Aug 23, 2016
1 parent e095116 commit 5d22c8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -72,7 +72,7 @@ def load_proxy_deposit_request
end

def proxy_deposit_request_params
params.require(:proxy_deposit_request).permit(:transfer_to)
params.require(:proxy_deposit_request).permit(:transfer_to, :sender_comment)
end
end
end
6 changes: 5 additions & 1 deletion spec/controllers/transfers_controller_spec.rb
Expand Up @@ -73,13 +73,17 @@
it "is successful" do
allow_any_instance_of(User).to receive(:display_name).and_return("Jill Z. User")
expect {
post :create, id: work.id, proxy_deposit_request: { transfer_to: another_user.user_key }
post :create, id: work.id, proxy_deposit_request: {
transfer_to: another_user.user_key,
sender_comment: 'Hi mom!'
}
}.to change(ProxyDepositRequest, :count).by(1)
expect(response).to redirect_to routes.url_helpers.transfers_path
expect(flash[:notice]).to eq('Transfer request created')
proxy_request = another_user.proxy_deposit_requests.first
expect(proxy_request.work_id).to eq(work.id)
expect(proxy_request.sending_user).to eq(user)
expect(proxy_request.sender_comment).to eq 'Hi mom!'
# AND A NOTIFICATION SHOULD HAVE BEEN CREATED
notification = another_user.reload.mailbox.inbox[0].messages[0]
expect(notification.subject).to eq("Ownership Change Request")
Expand Down

0 comments on commit 5d22c8f

Please sign in to comment.