mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 01:33:43 +08:00
a06fccae1b
Previously it was unclear why certain gems are being held back cause Gemfile had no comment explaining it. I tried to add some explanation from memory and remove some exceptions that seemed to be superfluous. This upgrades shoulda to latest, it appears to work once a couple of assertions are removed Also update http accept language used to auto detect language from http header this is tested Zeitwerk small update seems fine
27 lines
757 B
Ruby
27 lines
757 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe PostReply do
|
|
fab!(:topic) { Fabricate(:topic) }
|
|
fab!(:post) { Fabricate(:post, topic: topic) }
|
|
fab!(:other_post) { Fabricate(:post, topic: topic) }
|
|
|
|
context "validation" do
|
|
it "should ensure that the posts belong in the same topic" do
|
|
expect(PostReply.new(post: post, reply: other_post)).to be_valid
|
|
|
|
other_topic = Fabricate(:topic)
|
|
other_post.update!(topic_id: other_topic.id)
|
|
other_post.reload
|
|
|
|
post_reply = PostReply.new(post: post, reply: other_post)
|
|
expect(post_reply).to_not be_valid
|
|
|
|
expect(post_reply.errors[:base]).to include(
|
|
I18n.t("activerecord.errors.models.post_reply.base.different_topic")
|
|
)
|
|
end
|
|
end
|
|
end
|