From 51566ebe0b158aeec8833476561d1e5576a3c71d Mon Sep 17 00:00:00 2001 From: Pistos Date: Tue, 4 Oct 2011 10:22:50 -0400 Subject: [PATCH] Improve wording of error message in Reshare#root_must_be_public validation. --- app/models/reshare.rb | 4 ++-- spec/models/reshare_spec.rb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/reshare.rb b/app/models/reshare.rb index cfb17a646..15a1dc7db 100644 --- a/app/models/reshare.rb +++ b/app/models/reshare.rb @@ -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 diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index 51687a2a1..5795fc9eb 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -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