From f3f30edf3f8fdba6ca9d61abb30ec8fa9902544a Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Tue, 7 Jul 2020 12:20:31 +0530 Subject: [PATCH] SPEC: use post number to create canoncial path in mega topics. 6d177659247370f6be4c4e83f12d944f3d75bf92 --- spec/components/topic_view_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/components/topic_view_spec.rb b/spec/components/topic_view_spec.rb index 8bd81460419..31dcd75481c 100644 --- a/spec/components/topic_view_spec.rb +++ b/spec/components/topic_view_spec.rb @@ -258,6 +258,15 @@ describe TopicView do expect(TopicView.new(1234, user, post_number: 5, limit: 2) .canonical_path).to eql("/1234?page=2") end + + it "generates canonical path correctly for mega topics" do + 2.times { |i| Fabricate(:post, post_number: i + 1, topic: topic) } + 2.times { |i| Fabricate(:whisper, post_number: i + 3, topic: topic) } + Fabricate(:post, post_number: 5, topic: topic) + + expect(TopicView.new(1234, user, post_number: 5, limit: 2, is_mega_topic: true) + .canonical_path).to eql("/1234?page=3") + end end describe "#next_page" do