forked from e621ng/e621ng
fix tests
This commit is contained in:
parent
66de9c85a3
commit
341b29ce41
@ -7,7 +7,7 @@ module Maintenance
|
||||
def create
|
||||
@user = ::User.with_email(params[:user][:email]).first
|
||||
if @user
|
||||
LoginReminderMailer.notice(@user).deliver
|
||||
LoginReminderMailer.notice(@user).deliver_now
|
||||
flash[:notice] = "Email sent"
|
||||
else
|
||||
flash[:notice] = "Email address not found"
|
||||
|
@ -181,7 +181,7 @@ class Dmail < ActiveRecord::Base
|
||||
|
||||
def send_dmail
|
||||
if to.receive_email_notifications? && to.email.include?("@") && owner_id == to.id
|
||||
UserMailer.dmail_notice(self).deliver
|
||||
UserMailer.dmail_notice(self).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ class ForumSubscription < ActiveRecord::Base
|
||||
CurrentUser.scoped(subscription.user, "127.0.0.1") do
|
||||
forum_posts = forum_topic.posts.where("created_at > ?", subscription.last_read_at).order("id desc")
|
||||
begin
|
||||
UserMailer.forum_notice(subscription.user, forum_topic, forum_posts).deliver
|
||||
UserMailer.forum_notice(subscription.user, forum_topic, forum_posts).deliver_now
|
||||
rescue Net::SMTPSyntaxError
|
||||
end
|
||||
subscription.update_attribute(:last_read_at, forum_topic.updated_at)
|
||||
|
@ -9,7 +9,7 @@ class Note < ActiveRecord::Base
|
||||
before_validation :blank_body
|
||||
validates_presence_of :post_id, :creator_id, :updater_id, :x, :y, :width, :height
|
||||
validate :post_must_exist
|
||||
validate :note_within_image, :message => "must be inside the image"
|
||||
validate :note_within_image
|
||||
after_save :update_post
|
||||
after_save :create_version
|
||||
validate :post_must_not_be_note_locked
|
||||
|
@ -188,7 +188,7 @@ class User < ActiveRecord::Base
|
||||
|
||||
def reset_password_and_deliver_notice
|
||||
new_password = reset_password()
|
||||
Maintenance::User::PasswordResetMailer.confirmation(self, new_password).deliver
|
||||
Maintenance::User::PasswordResetMailer.confirmation(self, new_password).deliver_now
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -10,7 +10,7 @@ class UserPasswordResetNonce < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def deliver_notice
|
||||
Maintenance::User::PasswordResetMailer.reset_request(user, self).deliver
|
||||
Maintenance::User::PasswordResetMailer.reset_request(user, self).deliver_now
|
||||
end
|
||||
|
||||
def initialize_key
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h1>Password Reset Request</h1>
|
||||
|
||||
<p>Someone has requested that the password for "<%= @user.name %>" for the website <%= Danbooru.config.app_name %> be reset. If you did not request this, then you can ignore this email.</p>
|
||||
<p>To reset your password, please visit <%= link_to "this link", edit_maintenance_user_password_reset_path(:host => Danbooru.config.hostname, :only_path => false, :key => @nonce.key, :email => @nonce.email) %>.</p>
|
||||
<p>To reset your password, please visit <%= link_to "this link", edit_maintenance_user_password_reset_url(:host => Danbooru.config.hostname, :only_path => false, :key => @nonce.key, :email => @nonce.email) %>.</p>
|
||||
|
@ -10,6 +10,6 @@
|
||||
<%= DText.parse(@dmail.body) %>
|
||||
</div>
|
||||
|
||||
<p><%= link_to "View message", dmail_path(@dmail, :host => Danbooru.config.hostname, :only_path => false) %></p>
|
||||
<p><%= link_to "View message", dmail_url(@dmail, :host => Danbooru.config.hostname, :only_path => false) %></p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -20,6 +20,7 @@ module Danbooru
|
||||
config.action_mailer.smtp_settings = {:enable_starttls_auto => false}
|
||||
config.action_mailer.perform_deliveries = true
|
||||
config.log_tags = [lambda {|req| "PID:#{Process.pid}"}]
|
||||
config.active_support.test_order = :random
|
||||
end
|
||||
|
||||
I18n.enforce_available_locales = false
|
||||
|
@ -20,7 +20,7 @@ Rails.application.configure do
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = false
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
@ -13,7 +13,7 @@ Rails.application.configure do
|
||||
config.eager_load = false
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance.
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:artist_url) do
|
||||
artist
|
||||
url {Faker::Internet.domain_name}
|
||||
url {FFaker::Internet.domain_name}
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:ban) do |f|
|
||||
reason {Faker::Lorem.words.join(" ")}
|
||||
reason {FFaker::Lorem.words.join(" ")}
|
||||
duration 60
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:comment) do |f|
|
||||
post
|
||||
body {Faker::Lorem.sentences.join(" ")}
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory(:dmail) do
|
||||
to :factory => :user
|
||||
title {Faker::Lorem.words.join(" ")}
|
||||
body {Faker::Lorem.sentences.join(" ")}
|
||||
title {FFaker::Lorem.words.join(" ")}
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
FactoryGirl.define do
|
||||
factory(:forum_post) do
|
||||
body {Faker::Lorem.sentences.join(" ")}
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:forum_topic) do
|
||||
title {Faker::Lorem.words.join(" ")}
|
||||
title {FFaker::Lorem.words.join(" ")}
|
||||
is_sticky false
|
||||
is_locked false
|
||||
category_id 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory(:ip_ban) do
|
||||
creator :factory => :user
|
||||
reason {Faker::Lorem.words.join(" ")}
|
||||
reason {FFaker::Lorem.words.join(" ")}
|
||||
ip_addr "127.0.0.1"
|
||||
end
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ FactoryGirl.define do
|
||||
width 1
|
||||
height 1
|
||||
is_active true
|
||||
body {Faker::Lorem.sentences.join(" ")}
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
updater_id :factory => :user
|
||||
updater_ip_addr "127.0.0.1"
|
||||
end
|
||||
|
@ -2,6 +2,6 @@ FactoryGirl.define do
|
||||
factory(:pool) do
|
||||
name {(rand(1_000_000) + 100).to_s}
|
||||
association :creator, :factory => :user
|
||||
description {Faker::Lorem.sentences.join(" ")}
|
||||
description {FFaker::Lorem.sentences.join(" ")}
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,8 @@
|
||||
FactoryGirl.define do
|
||||
factory(:post) do
|
||||
md5 {|x| Time.now.to_f.to_s}
|
||||
sequence :md5 do |n|
|
||||
n.to_s
|
||||
end
|
||||
uploader :factory => :user
|
||||
uploader_ip_addr "127.0.0.1"
|
||||
tag_string "tag1 tag2"
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:tag) do
|
||||
name {"#{Faker::Name.first_name.downcase}#{rand(1000)}"}
|
||||
name {"#{FFaker::Name.first_name.downcase}#{rand(1000)}"}
|
||||
post_count 0
|
||||
category {Tag.categories.general}
|
||||
related_tags ""
|
||||
|
@ -1,6 +1,6 @@
|
||||
FactoryGirl.define do
|
||||
factory(:tag_subscription) do
|
||||
name {Faker::Lorem.words.join(" ")}
|
||||
name {FFaker::Lorem.words.join(" ")}
|
||||
is_public true
|
||||
tag_query "aaa"
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ FactoryGirl.define do
|
||||
name {(rand(1_000_000) + 10).to_s}
|
||||
password "password"
|
||||
password_hash {User.sha1("password")}
|
||||
email {Faker::Internet.email}
|
||||
email {FFaker::Internet.email}
|
||||
default_image_size "large"
|
||||
base_upload_limit 10
|
||||
level 20
|
||||
|
@ -2,6 +2,6 @@ FactoryGirl.define do
|
||||
factory(:user_feedback) do
|
||||
user
|
||||
category "positive"
|
||||
body {Faker::Lorem.words.join(" ")}
|
||||
body {FFaker::Lorem.words.join(" ")}
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
FactoryGirl.define do
|
||||
factory(:wiki_page) do
|
||||
creator :factory => :user
|
||||
title {Faker::Lorem.words.join(" ")}
|
||||
body {Faker::Lorem.sentences.join(" ")}
|
||||
title {FFaker::Lorem.words.join(" ")}
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
end
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -21,12 +21,12 @@ class DmailFilterTest < ActiveSupport::TestCase
|
||||
|
||||
should "filter on that word in the body" do
|
||||
create_dmail("banned", "okay")
|
||||
assert_equal(true, @receiver.dmails.last.is_deleted?)
|
||||
assert_equal(true, @receiver.dmails.last.is_read?)
|
||||
end
|
||||
|
||||
should "filter on that word in the title" do
|
||||
create_dmail("okay", "banned")
|
||||
assert_equal(true, @receiver.dmails.last.is_deleted?)
|
||||
assert_equal(true, @receiver.dmails.last.is_read?)
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,7 +37,7 @@ class DmailFilterTest < ActiveSupport::TestCase
|
||||
|
||||
should "filter on the sender" do
|
||||
create_dmail("okay", "okay")
|
||||
assert_equal(true, @receiver.dmails.last.is_deleted?)
|
||||
assert_equal(true, @receiver.dmails.last.is_read?)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,8 +8,8 @@ module Maintenance
|
||||
@user = FactoryGirl.create(:user)
|
||||
end
|
||||
|
||||
should "send the notie" do
|
||||
LoginReminderMailer.notice(@user).deliver
|
||||
should "send the notice" do
|
||||
LoginReminderMailer.notice(@user).deliver_now
|
||||
assert !ActionMailer::Base.deliveries.empty?
|
||||
end
|
||||
end
|
||||
|
@ -463,8 +463,8 @@ class PostTest < ActiveSupport::TestCase
|
||||
|
||||
context "as a new user" do
|
||||
setup do
|
||||
CurrentUser.user = FactoryGirl.create(:user)
|
||||
@post.update_attribute(:tag_string, "aaa bbb ccc ddd")
|
||||
CurrentUser.user = FactoryGirl.create(:user)
|
||||
end
|
||||
|
||||
should "not allow you to remove more than 2 tags" do
|
||||
|
@ -31,8 +31,8 @@ module Sources
|
||||
end
|
||||
|
||||
should "get the image url" do
|
||||
assert_equal("http://lohas.nicoseiga.jp/priv/2da967039fd50a09c634dba26c1162ecf1c35ef7/1436234417/4937663", @site_1.image_url)
|
||||
assert_equal("http://lohas.nicoseiga.jp/priv/ee9cb45867d86771abf4ba90c74de07bdc4c7e1a/1436234419/4937663", @site_2.image_url)
|
||||
assert_equal("http://lohas.nicoseiga.jp/priv/3a50d7fe7e55e57937e08eeadccb69611d8485bf/1439946517/4937663", @site_1.image_url)
|
||||
assert_equal("http://lohas.nicoseiga.jp/priv/2bd59bd4b014227d23aa78488ddec8d414c1bd38/1439946519/4937663", @site_2.image_url)
|
||||
end
|
||||
|
||||
should "get the tags" do
|
||||
|
Loading…
Reference in New Issue
Block a user