fixes specs
This commit is contained in:
@@ -8,9 +8,9 @@ class ProposalNotification < ActiveRecord::Base
|
||||
validate :minimum_interval
|
||||
|
||||
def minimum_interval
|
||||
return true if proposal.notifications.blank?
|
||||
return true if proposal.try(:notifications).blank?
|
||||
if proposal.notifications.last.created_at > (Time.now - Setting[:proposal_notification_minimum_interval_in_days].to_i.days).to_datetime
|
||||
errors.add(:minimum_interval, I18n.t('activerecord.errors.models.proposal_notification.minimum_interval', interval: Setting[:proposal_notification_minimum_interval]))
|
||||
errors.add(:title, I18n.t('activerecord.errors.models.proposal_notification.attributes.minimum_interval.invalid', interval: Setting[:proposal_notification_minimum_interval_in_days]))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ search:
|
||||
# - '{devise,simple_form}.*'
|
||||
ignore_missing:
|
||||
- 'unauthorized.*'
|
||||
- 'activerecord.errors.models.proposal_notification.*'
|
||||
- 'errors.messages.blank'
|
||||
- 'errors.messages.taken'
|
||||
- 'devise.failure.invalid'
|
||||
@@ -134,6 +135,7 @@ ignore_unused:
|
||||
- 'spending_proposals.index.search_form.*'
|
||||
- 'notifications.index.comments_on*'
|
||||
- 'notifications.index.replies_to*'
|
||||
- 'notifications.index.proposal_notification*'
|
||||
- 'helpers.page_entries_info.*' # kaminari
|
||||
- 'views.pagination.*' # kaminari
|
||||
- 'shared.suggest.*'
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
en:
|
||||
activerecord:
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
attributes:
|
||||
email:
|
||||
password_already_set: "This user already has a password"
|
||||
models:
|
||||
activity:
|
||||
one: "activity"
|
||||
@@ -76,6 +70,10 @@ en:
|
||||
title: "Title"
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
attributes:
|
||||
email:
|
||||
password_already_set: "This user already has a password"
|
||||
debate:
|
||||
attributes:
|
||||
tag_list:
|
||||
@@ -86,4 +84,5 @@ en:
|
||||
less_than_or_equal_to: "tags must be less than or equal to %{count}"
|
||||
proposal_notification:
|
||||
attributes:
|
||||
minimum_interval: "You have to wait a minium of %{interval} days between notifications"
|
||||
minimum_interval:
|
||||
invalid: "You have to wait a minium of %{interval} days between notifications"
|
||||
@@ -1,11 +1,5 @@
|
||||
es:
|
||||
activerecord:
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
attributes:
|
||||
email:
|
||||
password_already_set: "Este usuario ya tiene una clave asociada"
|
||||
models:
|
||||
activity:
|
||||
one: "actividad"
|
||||
@@ -76,6 +70,10 @@ es:
|
||||
title: "Título"
|
||||
errors:
|
||||
models:
|
||||
user:
|
||||
attributes:
|
||||
email:
|
||||
password_already_set: "Este usuario ya tiene una clave asociada"
|
||||
debate:
|
||||
attributes:
|
||||
tag_list:
|
||||
@@ -86,4 +84,5 @@ es:
|
||||
less_than_or_equal_to: "los temas deben ser menor o igual que %{count}"
|
||||
proposal_notification:
|
||||
attributes:
|
||||
minimum_interval: "Debes esperar un mínimo de %{interval} días entre notificaciones"
|
||||
minimum_interval:
|
||||
invalid: "Debes esperar un mínimo de %{interval} días entre notificaciones"
|
||||
@@ -181,7 +181,7 @@ feature 'Emails' do
|
||||
expect(unread_emails_for(author.email).size).to eql parse_email_count(0)
|
||||
|
||||
email = open_last_email
|
||||
expect(email).to have_subject("Thank you for supporting my proposal")
|
||||
expect(email).to have_subject("Thank you for supporting my proposal: #{proposal.title}")
|
||||
expect(email).to have_body_text("Please share it with others so we can make it happen!")
|
||||
expect(email).to have_body_text(proposal.title)
|
||||
end
|
||||
|
||||
@@ -86,11 +86,8 @@ feature 'Proposal Notifications' do
|
||||
|
||||
context "Limits" do
|
||||
|
||||
pending "Cannot send more than one notification within established interval" do
|
||||
end
|
||||
|
||||
pending "use timecop to make sure notifications can be sent after time interval" do
|
||||
end
|
||||
pending "Cannot send more than one notification within established interval"
|
||||
pending "use timecop to make sure notifications can be sent after time interval"
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user