FIX: external links in whisper ended up in a white page

FIX: clicking a link in a onebox wasn't properly extracting the post_id
This commit is contained in:
Régis Hanol
2017-12-20 17:55:15 +01:00
parent 6e1dd12390
commit 7f69362d9d
4 changed files with 40 additions and 27 deletions

View File

@ -50,7 +50,18 @@ describe ClicksController do
context 'with a post_id' do
it 'redirects' do
TopicLinkClick.expects(:create_from).with('url' => url, 'post_id' => '123', 'ip' => '192.168.0.1').returns(url)
get :track, params: { url: url, post_id: 123, format: :json }
expect(response).to redirect_to(url)
end
it "redirects links in whispers to staff members" do
log_in(:admin)
whisper = Fabricate(:post, post_type: Post.types[:whisper])
get :track, params: { url: url, post_id: whisper.id, format: :json }
expect(response).to redirect_to(url)
end
@ -63,7 +74,6 @@ describe ClicksController do
expect(response).not_to be_redirect
end
end
context 'with a topic_id' do