Skip to content

Commit

Permalink
Merge pull request #3996 from nebulab/spaghetticode/fix-flash-message
Browse files Browse the repository at this point in the history
[ADMIN] Properly format flash error message
  • Loading branch information
kennyadsl authored May 20, 2021
2 parents 6d5440f + f3b5d76 commit b6e24da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/app/controllers/spree/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def advance
if @order.can_complete?
flash[:success] = t('spree.order_ready_for_confirm')
else
flash[:error] = @order.errors.full_messages
flash[:error] = @order.errors.full_messages.join(', ')
end
redirect_to confirm_admin_order_url(@order)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@
context 'when unsuccessful' do
before do
allow(order).to receive(:can_complete?).and_return(false)
allow(order).to receive(:errors).and_return(double(full_messages: ['failed']))
allow(order).to receive(:errors).and_return(double(full_messages: ['invalid address', 'invalid email']))
end

it 'messages and redirects' do
subject
expect(flash[:error]).to eq order.errors.full_messages
expect(flash[:error]).to eq 'invalid address, invalid email'
expect(response).to redirect_to(spree.confirm_admin_order_path(order))
end
end
Expand Down

0 comments on commit b6e24da

Please sign in to comment.