setting to exclude rel nofollow from particular domains

This commit is contained in:
Sam Saffron
2013-02-11 18:58:19 +11:00
parent 80929ead4b
commit f68f59c24f
4 changed files with 17 additions and 3 deletions

View File

@ -79,6 +79,7 @@ test
describe "rel nofollow" do
before do
SiteSetting.stubs(:add_rel_nofollow_to_user_content).returns(true)
SiteSetting.stubs(:exclude_rel_nofollow_domains).returns("foo.com,bar.com")
end
it "should inject nofollow in all user provided links" do
@ -92,6 +93,14 @@ test
it "should not inject nofollow in all subdomain links" do
(PrettyText.cook("<a href='#{Discourse.base_url.sub('http://', 'http://bla.')}/test.html'>cnn</a>") !~ /nofollow/).should be_true
end
it "should not inject nofollow for foo.com" do
(PrettyText.cook("<a href='http://foo.com/test.html'>cnn</a>") !~ /nofollow/).should be_true
end
it "should not inject nofollow for bar.foo.com" do
(PrettyText.cook("<a href='http://bar.foo.com/test.html'>cnn</a>") !~ /nofollow/).should be_true
end
end
describe "Excerpt" do