401 -> 406 in controllers resolving http basic auth prompt on failed comment/status message creation. fixed status message validation.
This commit is contained in:
parent
5075a7384b
commit
94d08954d9
4 changed files with 7 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ class CommentsController < ApplicationController
|
|||
format.html{ render :nothing => true, :status => 201 }
|
||||
end
|
||||
else
|
||||
render :nothing => true, :status => 401
|
||||
render :nothing => true, :status => 406
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class StatusMessagesController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js{ render :status => 401 }
|
||||
format.js{ render :status => 406 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class StatusMessage < Post
|
|||
protected
|
||||
|
||||
def message_or_photos_present?
|
||||
unless self.message || self.photos.count > 0
|
||||
unless !self.message.blank? || self.photos.count > 0
|
||||
errors[:base] << 'Status message requires a message or at least one photo'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ describe StatusMessage do
|
|||
it "should have either a message or at least one photo" do
|
||||
n = Factory.build(:status_message, :message => nil)
|
||||
n.valid?.should be_false
|
||||
|
||||
n.message = ""
|
||||
n.valid?.should be_false
|
||||
|
||||
n.message = "wales"
|
||||
n.valid?.should be_true
|
||||
n.message = nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue