mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
19 lines
503 B
Ruby
19 lines
503 B
Ruby
require 'rails_helper'
|
|
|
|
describe ClicksController do
|
|
|
|
let(:url) { "https://discourse.org/" }
|
|
let(:headers) { { REMOTE_ADDR: "192.168.0.1" } }
|
|
let(:post) { create_post(raw: "this is a post with a link #{url}") }
|
|
|
|
context '#track' do
|
|
it "creates a TopicLinkClick" do
|
|
sign_in(Fabricate(:user))
|
|
|
|
expect {
|
|
get "/clicks/track", params: { url: url, post_id: post.id, topic_id: post.topic_id }, headers: headers
|
|
}.to change { TopicLinkClick.count }.by(1)
|
|
end
|
|
end
|
|
end
|