aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Räty <betelgeuse@gentoo.org>2011-02-20 21:33:44 +0200
committerPetteri Räty <betelgeuse@gentoo.org>2011-02-22 17:53:53 +0200
commit4396a16a976a46b11ecf281b5be054a0379ff35b (patch)
treeb845b08e14e8718760f54e2acd6fe5b94a216a4e
parentDocument need for gpgme in system. (diff)
downloadrecruiting-webapp-4396a16a976a46b11ecf281b5be054a0379ff35b.tar.gz
recruiting-webapp-4396a16a976a46b11ecf281b5be054a0379ff35b.tar.bz2
recruiting-webapp-4396a16a976a46b11ecf281b5be054a0379ff35b.zip
Fix deprecation warnings from delayed_job
-rw-r--r--app/models/answer.rb4
-rw-r--r--app/models/comment.rb2
-rw-r--r--app/models/email_answer.rb2
-rw-r--r--app/models/question.rb2
-rw-r--r--spec/models/answer_spec.rb4
-rw-r--r--spec/models/comment_spec.rb2
-rw-r--r--spec/models/email_answer_spec.rb4
-rw-r--r--spec/models/question_spec.rb4
-rw-r--r--spec/support/delayed_should_receive.rb11
9 files changed, 23 insertions, 12 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index d477e26..73e7750 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -149,12 +149,12 @@ class Answer < ActiveRecord::Base
protected
# Sends email notification about new answer to mentor of owner
def notify_new_answer
- UserMailer.send_later(:deliver_new_answer, owner.mentor, self) unless owner._?.mentor.nil?
+ UserMailer.delay.deliver_new_answer(owner.mentor, self) unless owner._?.mentor.nil?
end
# Sends email notification about changed answer to mentor of owner
def notify_changed_answer
- UserMailer.send_later(:deliver_changed_answer, owner.mentor, self) unless owner._?.mentor.nil?
+ UserMailer.delay.deliver_changed_answer(owner.mentor, self) unless owner._?.mentor.nil?
end
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index c10a8f2..cfbf1c1 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -47,6 +47,6 @@ class Comment < ActiveRecord::Base
protected
# Sends notification about new comment to owner of mentor
def notify_new_comment
- UserMailer.send_later(:deliver_new_comment, answer.owner, self)
+ UserMailer.delay.deliver_new_comment(answer.owner, self)
end
end
diff --git a/app/models/email_answer.rb b/app/models/email_answer.rb
index ffec1ac..5db9b97 100644
--- a/app/models/email_answer.rb
+++ b/app/models/email_answer.rb
@@ -36,7 +36,7 @@ class EmailAnswer < Answer
question = Question.first :conditions => { :id => subject.captures[0] }
if(question.nil? || !question.content.is_a?(QuestionContentEmail))
- UserMailer.send_later(:deliver_unrecognized_email, user, email)
+ UserMailer.delay.deliver_unrecognized_email(user, email)
return
end
diff --git a/app/models/question.rb b/app/models/question.rb
index c377d5e..b8cfed6 100644
--- a/app/models/question.rb
+++ b/app/models/question.rb
@@ -186,7 +186,7 @@ class Question < ActiveRecord::Base
# If question category isn't assigned don't try to access it
if question_category && approved
for user in question_category.users
- UserMailer.send_later(:deliver_new_question, user, self)
+ UserMailer.delay.deliver_new_question(user, self)
end
end
end
diff --git a/spec/models/answer_spec.rb b/spec/models/answer_spec.rb
index 200077d..de72393 100644
--- a/spec/models/answer_spec.rb
+++ b/spec/models/answer_spec.rb
@@ -141,14 +141,14 @@ describe Answer do
#can't use Factory Girl here, because we want to save it after setting expectation to get email
answer = Answer.new(:owner => recruit, :question => question, :content => "Some answer.")
- UserMailer.should_receive(:send_later).with(:deliver_new_answer, recruit.mentor, answer)
+ UserMailer.should_receive_delayed(:deliver_new_answer, recruit.mentor, answer)
answer.save!
end
it "should send email notification to mentor when changed" do
answer = Factory(:answer)
- UserMailer.should_receive(:send_later).with(:deliver_changed_answer, answer.owner.mentor, answer)
+ UserMailer.should_receive_delayed(:deliver_changed_answer, answer.owner.mentor, answer)
answer.content = "changed"
answer.save!
end
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index 8a071c6..7b5e5d9 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -49,7 +49,7 @@ describe Comment do
answer = Factory(:answer)
comment = Comment.new(:owner => answer.owner.mentor, :answer => answer, :content => "some comment")
- UserMailer.should_receive(:send_later).with(:deliver_new_comment, answer.owner, comment)
+ UserMailer.should_receive_delayed(:deliver_new_comment, answer.owner, comment)
comment.save!
end
diff --git a/spec/models/email_answer_spec.rb b/spec/models/email_answer_spec.rb
index b452a19..3e7096f 100644
--- a/spec/models/email_answer_spec.rb
+++ b/spec/models/email_answer_spec.rb
@@ -7,7 +7,7 @@ describe EmailAnswer do
mail.subject = "#{question.id + 1}-#{recruit.token}"
mail.from = recruit.email_address
- UserMailer.should_receive(:send_later).with(:deliver_unrecognized_email, recruit, mail)
+ UserMailer.should_receive_delayed(:deliver_unrecognized_email, recruit, mail)
EmailAnswer.answer_from_email(mail)
end
@@ -18,7 +18,7 @@ describe EmailAnswer do
mail.subject = "#{question.id}-#{recruit.token}"
mail.from = recruit.email_address
- UserMailer.should_receive(:send_later).with(:deliver_unrecognized_email, recruit, mail)
+ UserMailer.should_receive_delayed(:deliver_unrecognized_email, recruit, mail)
EmailAnswer.answer_from_email(mail)
end
diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb
index b8ff206..0489be4 100644
--- a/spec/models/question_spec.rb
+++ b/spec/models/question_spec.rb
@@ -71,7 +71,7 @@ describe Question do
question = Question.new(:title => "new question",
:question_category => category)
- UserMailer.should_receive(:send_later).with(:deliver_new_question, recruit, question)
+ UserMailer.should_receive_delayed(:deliver_new_question, recruit, question)
question.save!
end
@@ -82,7 +82,7 @@ describe Question do
question = Factory(:question, :title => "new question",
:question_category => category, :user => Factory(:recruit))
- UserMailer.should_receive(:send_later).with(:deliver_new_question, recruit, question)
+ UserMailer.should_receive_delayed(:deliver_new_question, recruit, question)
question.approved = true
question.save!
end
diff --git a/spec/support/delayed_should_receive.rb b/spec/support/delayed_should_receive.rb
new file mode 100644
index 0000000..c3a333e
--- /dev/null
+++ b/spec/support/delayed_should_receive.rb
@@ -0,0 +1,11 @@
+class Object
+ def should_receive_delayed(method, *args)
+ m = Spec::Mocks::Mock.new('proxy')
+ if args.empty?
+ m.should_receive(method)
+ else
+ m.should_receive(method).with(*args)
+ end
+ self.should_receive(:delay).and_return(m)
+ end
+end