make status_message_controller#create return the error message
This commit is contained in:
parent
e4ba498d70
commit
ec21230756
2 changed files with 7 additions and 1 deletions
|
|
@ -59,7 +59,8 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js { render :status => 406 }
|
||||
format.js { render :text => @status_message.errors.full_messages, :status => 406 }
|
||||
format.html {redirect_to :back}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ describe StatusMessagesController do
|
|||
}
|
||||
post :create, status_message_hash
|
||||
end
|
||||
it 'sends the errors in the body on js' do
|
||||
post :create, status_message_hash.merge!(:format => 'js', :status_message => {:message => ''})
|
||||
response.body.should == 'Status message requires a message or at least one photo'
|
||||
end
|
||||
|
||||
|
||||
context 'with photos' do
|
||||
before do
|
||||
|
|
|
|||
Loading…
Reference in a new issue