Prefabricated more things

This commit is contained in:
Daniel Waterworth 2019-05-06 12:29:20 +01:00 committed by Robin Ward
parent c403569895
commit d0c7e3469d
1 changed files with 22 additions and 22 deletions

View File

@ -24,11 +24,11 @@ describe PostMover do
context 'topics' do
fab!(:user) { Fabricate(:user, admin: true) }
fab!(:another_user) { Fabricate(:evil_trout) }
let(:category) { Fabricate(:category, user: user) }
let!(:topic) { Fabricate(:topic, user: user) }
let!(:p1) { Fabricate(:post, topic: topic, user: user, created_at: 3.hours.ago) }
fab!(:category) { Fabricate(:category, user: user) }
fab!(:topic) { Fabricate(:topic, user: user) }
fab!(:p1) { Fabricate(:post, topic: topic, user: user, created_at: 3.hours.ago) }
let!(:p2) do
fab!(:p2) do
Fabricate(:post,
topic: topic,
user: another_user,
@ -36,8 +36,8 @@ describe PostMover do
reply_to_post_number: p1.post_number)
end
let!(:p3) { Fabricate(:post, topic: topic, reply_to_post_number: p1.post_number, user: user) }
let!(:p4) { Fabricate(:post, topic: topic, reply_to_post_number: p2.post_number, user: user) }
fab!(:p3) { Fabricate(:post, topic: topic, reply_to_post_number: p1.post_number, user: user) }
fab!(:p4) { Fabricate(:post, topic: topic, reply_to_post_number: p2.post_number, user: user) }
fab!(:p5) { Fabricate(:post) }
let(:p6) { Fabricate(:post, topic: topic) }
@ -285,8 +285,8 @@ describe PostMover do
end
context "to an existing topic" do
let!(:destination_topic) { Fabricate(:topic, user: another_user) }
let!(:destination_op) { Fabricate(:post, topic: destination_topic, user: another_user) }
fab!(:destination_topic) { Fabricate(:topic, user: another_user) }
fab!(:destination_op) { Fabricate(:post, topic: destination_topic, user: another_user) }
it "works correctly" do
topic.expects(:add_moderator_post).once
@ -494,9 +494,9 @@ describe PostMover do
topic.expects(:add_moderator_post)
end
let!(:destination_topic) { Fabricate(:topic, user: user) }
let!(:destination_op) { Fabricate(:post, topic: destination_topic, user: user) }
let!(:destination_deleted_reply) { Fabricate(:post, topic: destination_topic, user: another_user) }
fab!(:destination_topic) { Fabricate(:topic, user: user) }
fab!(:destination_op) { Fabricate(:post, topic: destination_topic, user: user) }
fab!(:destination_deleted_reply) { Fabricate(:post, topic: destination_topic, user: another_user) }
let(:moved_to) { topic.move_posts(user, [p2.id, p4.id], destination_topic_id: destination_topic.id) }
it "works correctly" do
@ -526,7 +526,7 @@ describe PostMover do
end
context "to an existing closed topic" do
let!(:destination_topic) { Fabricate(:topic, closed: true) }
fab!(:destination_topic) { Fabricate(:topic, closed: true) }
it "works correctly for admin" do
admin = Fabricate(:admin)
@ -560,12 +560,12 @@ describe PostMover do
fab!(:another_user) { Fabricate(:user) }
fab!(:regular_user) { Fabricate(:trust_level_4) }
fab!(:topic) { Fabricate(:topic) }
let(:personal_message) { Fabricate(:private_message_topic, user: evil_trout) }
let!(:p1) { Fabricate(:post, topic: personal_message, user: user) }
let!(:p2) { Fabricate(:post, topic: personal_message, reply_to_post_number: p1.post_number, user: another_user) }
let!(:p3) { Fabricate(:post, topic: personal_message, reply_to_post_number: p1.post_number, user: user) }
let!(:p4) { Fabricate(:post, topic: personal_message, reply_to_post_number: p2.post_number, user: user) }
let!(:p5) { Fabricate(:post, topic: personal_message, user: evil_trout) }
fab!(:personal_message) { Fabricate(:private_message_topic, user: evil_trout) }
fab!(:p1) { Fabricate(:post, topic: personal_message, user: user) }
fab!(:p2) { Fabricate(:post, topic: personal_message, reply_to_post_number: p1.post_number, user: another_user) }
fab!(:p3) { Fabricate(:post, topic: personal_message, reply_to_post_number: p1.post_number, user: user) }
fab!(:p4) { Fabricate(:post, topic: personal_message, reply_to_post_number: p2.post_number, user: user) }
fab!(:p5) { Fabricate(:post, topic: personal_message, user: evil_trout) }
let(:another_personal_message) do
Fabricate(:private_message_topic, user: user, topic_allowed_users: [
Fabricate.build(:topic_allowed_user, user: admin)
@ -686,10 +686,10 @@ describe PostMover do
fab!(:evil_trout) { Fabricate(:evil_trout) }
fab!(:regular_user) { Fabricate(:trust_level_4) }
fab!(:topic) { Fabricate(:topic) }
let(:personal_message) { Fabricate(:private_message_topic, user: regular_user) }
let(:banner_topic) { Fabricate(:banner_topic, user: evil_trout) }
let!(:p1) { Fabricate(:post, topic: banner_topic, user: evil_trout) }
let!(:p2) { Fabricate(:post, topic: banner_topic, reply_to_post_number: p1.post_number, user: regular_user) }
fab!(:personal_message) { Fabricate(:private_message_topic, user: regular_user) }
fab!(:banner_topic) { Fabricate(:banner_topic, user: evil_trout) }
fab!(:p1) { Fabricate(:post, topic: banner_topic, user: evil_trout) }
fab!(:p2) { Fabricate(:post, topic: banner_topic, reply_to_post_number: p1.post_number, user: regular_user) }
context 'move to existing topic' do
it "allows moving banner topic posts in regular topic" do