Improve wording of error message in Reshare#root_must_be_public validation.
This commit is contained in:
parent
a9c6905e29
commit
51566ebe0b
2 changed files with 5 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ class Reshare < Post
|
||||||
def notification_type(user, person)
|
def notification_type(user, person)
|
||||||
Notifications::Reshared if root.author == user.person
|
Notifications::Reshared if root.author == user.person
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def after_parse
|
def after_parse
|
||||||
|
|
@ -71,7 +71,7 @@ class Reshare < Post
|
||||||
|
|
||||||
def root_must_be_public
|
def root_must_be_public
|
||||||
if self.root && !self.root.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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ describe Reshare do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'require public root' do
|
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
|
end
|
||||||
|
|
||||||
it 'forces public' do
|
it 'forces public' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue