Merge pull request #421 from ZogStriP/fixing-topic-specs
fix the specs errors due to a change to the min topic title's length
This commit is contained in:
commit
d06449b257
|
@ -16,7 +16,7 @@ describe Search do
|
||||||
context 'post indexing observer' do
|
context 'post indexing observer' do
|
||||||
before do
|
before do
|
||||||
@category = Fabricate(:category, name: 'america')
|
@category = Fabricate(:category, name: 'america')
|
||||||
@topic = Fabricate(:topic, title: 'sam test topic', category: @category)
|
@topic = Fabricate(:topic, title: 'sam saffron test topic', category: @category)
|
||||||
@post = Fabricate(:post, topic: @topic, raw: 'this <b>fun test</b> <img src="bla" title="my image">')
|
@post = Fabricate(:post, topic: @topic, raw: 'this <b>fun test</b> <img src="bla" title="my image">')
|
||||||
@indexed = Topic.exec_sql("select search_data from posts_search where id = #{@post.id}").first["search_data"]
|
@indexed = Topic.exec_sql("select search_data from posts_search where id = #{@post.id}").first["search_data"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Fabricator(:topic) do
|
Fabricator(:topic) do
|
||||||
user
|
user
|
||||||
title { sequence(:title) { |i| "Test topic #{i}" } }
|
title { sequence(:title) { |i| "This is a test topic #{i}" } }
|
||||||
end
|
end
|
||||||
|
|
||||||
Fabricator(:deleted_topic, from: :topic) do
|
Fabricator(:deleted_topic, from: :topic) do
|
||||||
|
@ -12,7 +12,7 @@ end
|
||||||
|
|
||||||
Fabricator(:private_message_topic, from: :topic) do
|
Fabricator(:private_message_topic, from: :topic) do
|
||||||
user
|
user
|
||||||
title { sequence(:title) { |i| "Private Message #{i}" } }
|
title { sequence(:title) { |i| "This is a private message #{i}" } }
|
||||||
archetype "private_message"
|
archetype "private_message"
|
||||||
topic_allowed_users{|t| [
|
topic_allowed_users{|t| [
|
||||||
Fabricate.build(:topic_allowed_user, user_id: t[:user].id),
|
Fabricate.build(:topic_allowed_user, user_id: t[:user].id),
|
||||||
|
|
|
@ -193,12 +193,12 @@ describe Topic do
|
||||||
it "enqueues a job to notify users" do
|
it "enqueues a job to notify users" do
|
||||||
topic.stubs(:add_moderator_post)
|
topic.stubs(:add_moderator_post)
|
||||||
Jobs.expects(:enqueue).with(:notify_moved_posts, post_ids: [p1.id, p4.id], moved_by_id: user.id)
|
Jobs.expects(:enqueue).with(:notify_moved_posts, post_ids: [p1.id, p4.id], moved_by_id: user.id)
|
||||||
topic.move_posts(user, "new topic name", [p1.id, p4.id])
|
topic.move_posts(user, "new testing topic name", [p1.id, p4.id])
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adds a moderator post at the location of the first moved post" do
|
it "adds a moderator post at the location of the first moved post" do
|
||||||
topic.expects(:add_moderator_post).with(user, instance_of(String), has_entries(post_number: 2))
|
topic.expects(:add_moderator_post).with(user, instance_of(String), has_entries(post_number: 2))
|
||||||
topic.move_posts(user, "new topic name", [p2.id, p4.id])
|
topic.move_posts(user, "new testing topic name", [p2.id, p4.id])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -206,11 +206,11 @@ describe Topic do
|
||||||
context "errors" do
|
context "errors" do
|
||||||
|
|
||||||
it "raises an error when one of the posts doesn't exist" do
|
it "raises an error when one of the posts doesn't exist" do
|
||||||
lambda { topic.move_posts(user, "new topic name", [1003]) }.should raise_error(Discourse::InvalidParameters)
|
lambda { topic.move_posts(user, "new testing topic name", [1003]) }.should raise_error(Discourse::InvalidParameters)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error if no posts were moved" do
|
it "raises an error if no posts were moved" do
|
||||||
lambda { topic.move_posts(user, "new topic name", []) }.should raise_error(Discourse::InvalidParameters)
|
lambda { topic.move_posts(user, "new testing topic name", []) }.should raise_error(Discourse::InvalidParameters)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -221,7 +221,7 @@ describe Topic do
|
||||||
TopicUser.update_last_read(user, topic.id, p4.post_number, 0)
|
TopicUser.update_last_read(user, topic.id, p4.post_number, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
let!(:new_topic) { topic.move_posts(user, "new topic name", [p2.id, p4.id]) }
|
let!(:new_topic) { topic.move_posts(user, "new testing topic name", [p2.id, p4.id]) }
|
||||||
|
|
||||||
|
|
||||||
it "updates the user's last_read_post_number" do
|
it "updates the user's last_read_post_number" do
|
||||||
|
|
Loading…
Reference in New Issue