mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
secure the links on the topic pages, eliminated deleted topics as well.
This commit is contained in:
@@ -12,10 +12,6 @@ describe TopicLinkClick do
|
||||
URI.parse('http://test.host')
|
||||
end
|
||||
|
||||
it 'returns blank from counts_for without posts' do
|
||||
TopicLinkClick.counts_for(nil, nil).should be_blank
|
||||
end
|
||||
|
||||
context 'topic_links' do
|
||||
before do
|
||||
@topic = Fabricate(:topic)
|
||||
@@ -46,25 +42,6 @@ describe TopicLinkClick do
|
||||
TopicLinkClick.first.ip.to_s.should == '192.168.1.1'
|
||||
end
|
||||
|
||||
context 'counts for' do
|
||||
|
||||
before do
|
||||
@counts_for = TopicLinkClick.counts_for(@topic, [@post])
|
||||
end
|
||||
|
||||
it 'has a counts_for result' do
|
||||
@counts_for[@post.id].should be_present
|
||||
end
|
||||
|
||||
it 'contains the click we made' do
|
||||
@counts_for[@post.id].first[:clicks].should == 1
|
||||
end
|
||||
|
||||
it 'has no clicks on another url in the post' do
|
||||
@counts_for[@post.id].find {|l| l[:url] == 'http://google.com'}[:clicks].should == 0
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context 'create_from' do
|
||||
@@ -82,10 +59,8 @@ describe TopicLinkClick do
|
||||
}.should_not change(TopicLinkClick, :count)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
context 'with a valid url and post_id' do
|
||||
before do
|
||||
TopicLinkClick.create_from(url: @topic_link.url, post_id: @post.id, ip: '127.0.0.1')
|
||||
|
||||
Reference in New Issue
Block a user