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