Improve wording of error message in Reshare#root_must_be_public validation.

This commit is contained in:
Pistos 2011-10-04 10:22:50 -04:00
parent a9c6905e29
commit 51566ebe0b
2 changed files with 5 additions and 3 deletions

View file

@ -36,7 +36,7 @@ class Reshare < Post
def notification_type(user, person)
Notifications::Reshared if root.author == user.person
end
private
def after_parse
@ -71,7 +71,7 @@ class Reshare < Post
def root_must_be_public
if self.root && !self.root.public
errors[:base] << "you must reshare public posts"
errors[:base] << "Only posts which are public may be reshared."
return false
end
end

View file

@ -18,7 +18,9 @@ describe Reshare do
end
it 'require public root' do
Factory.build(:reshare, :root => Factory.build(:status_message, :public => false)).should_not be_valid
reshare = Factory.build(:reshare, :root => Factory.build(:status_message, :public => false))
reshare.should_not be_valid
reshare.errors[:base].should include('Only posts which are public may be reshared.')
end
it 'forces public' do