Permalink
Browse files

Now checks Slideshare accounts for stopwords.

(e.g. slideshare.net/featured)
Addresses issue GH-1.
  • Loading branch information...
globalspin committed Aug 23, 2012
1 parent c79f9a8 commit d384c6f3de00486701ce41c79269f3f8fe6ade76
Showing with 30 additions and 1 deletion.
  1. +9 −1 lib/services/slideshare_service.rb
  2. +21 −0 spec/models/service_spec.rb
@@ -12,7 +12,15 @@ def display_name
end
def account
- /\/(?<account>[\w-]+)$/ =~ @uri.path
+ /\/(?<account>[\w-]+)$/ =~ @uri.path
+
+
+ @exclude = ['newsfeed', 'popular', 'most-downloaded', 'most-favorited',
+ 'pro_accounts', 'popular', 'featured', 'features']
+ if @exclude.any? {|stopword| account == stopword}
+ account = nil
+ end
+
account
end
@@ -39,6 +39,11 @@
service = Service.find_by_url("http://www.youtube.com/USGovernment")
service.shortname.should == :youtube
end
+
+ it "should ignore system URLs" do
+ service = Service.find_by_url("http://www.youtube.com/watch")
+ service.account.should be_nil
+ end
end
describe "Flickr plugin" do
@@ -72,4 +77,20 @@
service.account.should == '+NASA'
end
end
+
+ describe "Slideshare plugin" do
+
+ it "should be chosen for Slideshare URLs" do
+ service = Service.find_by_url("http://www.slideshare.net/nasa")
+ service.shortname.should == :slideshare
+ end
+
+ it "should ignore system URLs" do
+ service = Service.find_by_url("http://www.slideshare.net/nasa")
+ service.account.should == 'nasa'
+
+ service = Service.find_by_url("http://www.slideshare.net/popular")
+ service.account.should be_nil
+ end
+ end
end

0 comments on commit d384c6f

Please sign in to comment.