2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-12 21:10:47 +08:00

FEATURE: add context for cross topic links

This commit is contained in:
Sam 2015-09-25 14:52:43 +10:00
parent 150ad01111
commit fc2d61136d
3 changed files with 28 additions and 6 deletions

View file

@ -35,9 +35,14 @@ describe Onebox::Engine::DiscourseLocalOnebox do
end

it "returns some onebox goodness if post exists and can be seen" do
url = "#{Discourse.base_url}#{post2.url}"
url = "#{Discourse.base_url}#{post2.url}?source_topic_id=#{post2.topic_id+1}"
Guardian.any_instance.stubs(:can_see?).returns(true)
html = Onebox.preview(url).to_s
expect(html).to include(post2.excerpt)
expect(html).to include(post2.topic.title)

url = "#{Discourse.base_url}#{post2.url}"
html = Onebox.preview(url).to_s
expect(html).to include(post2.user.username)
expect(html).to include(post2.excerpt)
end