mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 11:34:43 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
19 lines
545 B
Ruby
19 lines
545 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ClicksController do
|
|
|
|
let(:url) { "https://discourse.org/" }
|
|
let(:headers) { { REMOTE_ADDR: "192.168.0.1" } }
|
|
let(:post_with_url) { create_post(raw: "this is a post with a link #{url}") }
|
|
|
|
describe '#track' do
|
|
it "creates a TopicLinkClick" do
|
|
sign_in(Fabricate(:user))
|
|
|
|
expect {
|
|
post "/clicks/track", params: { url: url, post_id: post_with_url.id, topic_id: post_with_url.topic_id }, headers: headers
|
|
}.to change { TopicLinkClick.count }.by(1)
|
|
end
|
|
end
|
|
end
|