Fix the build.
This commit is contained in:
parent
be71f9ff82
commit
b068a8a771
|
@ -153,7 +153,7 @@ class PostMover
|
||||||
def move_email_logs(old_post, new_post)
|
def move_email_logs(old_post, new_post)
|
||||||
EmailLog
|
EmailLog
|
||||||
.where(post_id: old_post.id)
|
.where(post_id: old_post.id)
|
||||||
.update_all(topic_id: new_post.topic_id, post_id: new_post.id)
|
.update_all(post_id: new_post.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_statistics
|
def update_statistics
|
||||||
|
|
|
@ -356,22 +356,35 @@ describe PostMover do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "moves email log entries" do
|
it "moves email log entries" do
|
||||||
|
|
||||||
skip "@tgxworld to fix"
|
|
||||||
|
|
||||||
old_topic = old_post.topic
|
old_topic = old_post.topic
|
||||||
Fabricate(:email_log, user: old_post.user, topic: old_topic, post: old_post, email_type: :mailing_list)
|
|
||||||
Fabricate(:email_log, user: old_post.user, topic: old_topic, post: old_post, email_type: :mailing_list)
|
|
||||||
Fabricate(:email_log, user: old_post.user, post: old_post, email_type: :mailing_list)
|
|
||||||
|
|
||||||
expect(EmailLog.where(topic_id: old_topic.id, post_id: old_post.id).count).to eq(2)
|
2.times do
|
||||||
expect(EmailLog.where(topic_id: nil, post_id: old_post.id).count).to eq(1)
|
Fabricate(:email_log,
|
||||||
|
user: old_post.user,
|
||||||
|
post: old_post,
|
||||||
|
email_type: :mailing_list
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
some_post = Fabricate(:post)
|
||||||
|
|
||||||
|
Fabricate(:email_log,
|
||||||
|
user: some_post.user,
|
||||||
|
post: some_post,
|
||||||
|
email_type: :mailing_list
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(EmailLog.where(post_id: old_post.id).count).to eq(2)
|
||||||
|
|
||||||
|
new_topic = old_topic.move_posts(
|
||||||
|
user,
|
||||||
|
[old_post.id],
|
||||||
|
title: "new testing topic name"
|
||||||
|
)
|
||||||
|
|
||||||
new_topic = old_topic.move_posts(user, [old_post.id], title: "new testing topic name")
|
|
||||||
new_post = new_topic.first_post
|
new_post = new_topic.first_post
|
||||||
|
|
||||||
expect(EmailLog.where(topic_id: old_topic.id, post_id: old_post.id).count).to eq(0)
|
expect(EmailLog.where(post_id: new_post.id).count).to eq(2)
|
||||||
expect(EmailLog.where(topic_id: new_topic.id, post_id: new_post.id).count).to eq(3)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "preserves post attributes" do
|
it "preserves post attributes" do
|
||||||
|
|
Loading…
Reference in New Issue