fix dmail tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
class CurrentUser
|
class CurrentUser
|
||||||
def self.scoped(user, ip_addr)
|
def self.scoped(user, ip_addr = "127.0.0.1")
|
||||||
old_user = self.user
|
old_user = self.user
|
||||||
old_ip_addr = self.ip_addr
|
old_ip_addr = self.ip_addr
|
||||||
|
|
||||||
|
|||||||
@@ -1282,14 +1282,18 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_iqdb_async
|
def update_iqdb_async
|
||||||
Danbooru.config.all_server_hosts.each do |host|
|
if Danbooru.config.iqdb_hostname_and_port
|
||||||
delay(:queue => host).update_iqdb
|
Danbooru.config.all_server_hosts.each do |host|
|
||||||
|
delay(:queue => host).update_iqdb
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_iqdb_async
|
def remove_iqdb_async
|
||||||
Danbooru.config.all_server_hosts.each do |host|
|
if Danbooru.config.iqdb_hostname_and_port
|
||||||
Post.delay(:queue => host).remove_iqdb(id)
|
Danbooru.config.all_server_hosts.each do |host|
|
||||||
|
Post.delay(:queue => host).remove_iqdb(id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -92,9 +92,16 @@ class DmailTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
should "notify the recipient he has mail" do
|
should "notify the recipient he has mail" do
|
||||||
dmail = FactoryGirl.create(:dmail, :owner => @user)
|
dmail = FactoryGirl.create(:dmail, :owner => @user)
|
||||||
assert(dmail.to(true).has_mail?)
|
recipient = dmail.to
|
||||||
dmail.mark_as_read!
|
recipient.reload
|
||||||
assert(!dmail.to(true).has_mail?)
|
assert(recipient.has_mail?)
|
||||||
|
|
||||||
|
CurrentUser.scoped(recipient) do
|
||||||
|
dmail.mark_as_read!
|
||||||
|
end
|
||||||
|
|
||||||
|
recipient.reload
|
||||||
|
assert(!recipient.has_mail?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user