sniffles 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +53 -2
  3. data/lib/sniffles/sniffers/advertising/admeld.rb +24 -0
  4. data/lib/sniffles/sniffers/advertising/adsense.rb +30 -0
  5. data/lib/sniffles/sniffers/advertising/buysellads.rb +24 -0
  6. data/lib/sniffles/sniffers/advertising/casale.rb +24 -0
  7. data/lib/sniffles/sniffers/analytics/chartbeat.rb +24 -0
  8. data/lib/sniffles/sniffers/analytics/clicky.rb +24 -0
  9. data/lib/sniffles/sniffers/analytics/google_analytics.rb +4 -3
  10. data/lib/sniffles/sniffers/analytics/kissmetrics.rb +24 -0
  11. data/lib/sniffles/sniffers/analytics/mixpanel.rb +2 -2
  12. data/lib/sniffles/sniffers/analytics/quantcast.rb +2 -2
  13. data/lib/sniffles/sniffers/cms/blogger.rb +28 -0
  14. data/lib/sniffles/sniffers/cms/cscart.rb +24 -0
  15. data/lib/sniffles/sniffers/cms/movabletype.rb +28 -0
  16. data/lib/sniffles/sniffers/cms/oscommerce.rb +24 -0
  17. data/lib/sniffles/sniffers/cms/phpbb.rb +27 -0
  18. data/lib/sniffles/sniffers/cms/posterous.rb +28 -0
  19. data/lib/sniffles/sniffers/cms/tumblr.rb +24 -0
  20. data/lib/sniffles/sniffers/cms/vanilla.rb +24 -0
  21. data/lib/sniffles/sniffers/cms/vbulletin.rb +39 -0
  22. data/lib/sniffles/sniffers/cms/wordpress.rb +7 -6
  23. data/lib/sniffles/sniffers/cms/xenforo.rb +28 -0
  24. data/lib/sniffles/sniffers/cms/zencart.rb +28 -0
  25. data/lib/sniffles/sniffers/javascript/jquery.rb +2 -2
  26. data/lib/sniffles/version.rb +1 -1
  27. data/lib/sniffles.rb +1 -1
  28. data/spec/cassettes/beenverified_com.yml +798 -0
  29. data/spec/cassettes/blog_posterous_com.yml +5015 -0
  30. data/spec/cassettes/demo_cs-cart_com.yml +1167 -0
  31. data/spec/cassettes/demo_oscommerce_com.yml +422 -0
  32. data/spec/cassettes/forum-software_org_vanilla.yml +223 -0
  33. data/spec/cassettes/foursquare_com.yml +363 -0
  34. data/spec/cassettes/google_blogspot_com.yml +1073 -0
  35. data/spec/cassettes/guistyles_com.yml +1306 -0
  36. data/spec/cassettes/humemes_com.yml +2 -2
  37. data/spec/cassettes/movabletype_com_blog.yml +1234 -0
  38. data/spec/cassettes/orangecrushbeads_com.yml +751 -0
  39. data/spec/cassettes/pearsonified_com.yml +11 -11
  40. data/spec/cassettes/phpbb_com.yml +466 -0
  41. data/spec/cassettes/squidoo_com.yml +466 -458
  42. data/spec/cassettes/staff_tumblr_com.yml +1673 -0
  43. data/spec/cassettes/topix_com.yml +1431 -0
  44. data/spec/cassettes/vbulletin_com.yml +2983 -0
  45. data/spec/cassettes/wordpress_com.yml +879 -0
  46. data/spec/cassettes/wundergroud_com.yml +907 -0
  47. data/spec/cassettes/xenforo_com.yml +1947 -0
  48. data/spec/sniffles/sniffers/advertising/admeld_spec.rb +17 -0
  49. data/spec/sniffles/sniffers/advertising/adsense_spec.rb +19 -0
  50. data/spec/sniffles/sniffers/advertising/buysellads_spec.rb +18 -0
  51. data/spec/sniffles/sniffers/advertising/casale_spec.rb +18 -0
  52. data/spec/sniffles/sniffers/analytics/chartbeat_spec.rb +17 -0
  53. data/spec/sniffles/sniffers/analytics/clicky_spec.rb +17 -0
  54. data/spec/sniffles/sniffers/analytics/google_analytics_spec.rb +11 -31
  55. data/spec/sniffles/sniffers/analytics/kissmetrics_spec.rb +17 -0
  56. data/spec/sniffles/sniffers/analytics/mixpanel_spec.rb +8 -13
  57. data/spec/sniffles/sniffers/analytics/quantcast_spec.rb +7 -12
  58. data/spec/sniffles/sniffers/cms/blogger_spec.rb +18 -0
  59. data/spec/sniffles/sniffers/cms/cscart_spec.rb +18 -0
  60. data/spec/sniffles/sniffers/cms/movabletype_spec.rb +18 -0
  61. data/spec/sniffles/sniffers/cms/oscommerce_spec.rb +18 -0
  62. data/spec/sniffles/sniffers/cms/phpbb_spec.rb +18 -0
  63. data/spec/sniffles/sniffers/cms/posterous_spec.rb +18 -0
  64. data/spec/sniffles/sniffers/cms/tumblr_spec.rb +18 -0
  65. data/spec/sniffles/sniffers/cms/vanilla_spec.rb +18 -0
  66. data/spec/sniffles/sniffers/cms/vbulletin_spec.rb +21 -0
  67. data/spec/sniffles/sniffers/cms/wordpress_spec.rb +17 -48
  68. data/spec/sniffles/sniffers/cms/xenforo_spec.rb +18 -0
  69. data/spec/sniffles/sniffers/cms/zencart_spec.rb +18 -0
  70. data/spec/sniffles/sniffers/javascript/jquery_spec.rb +8 -15
  71. data/spec/sniffles/sniffers_spec.rb +8 -19
  72. data/spec/sniffles_spec.rb +14 -41
  73. data/spec/spec_helper.rb +1 -10
  74. data/spec/support/helpers.rb +12 -0
  75. metadata +106 -14
  76. data/Gemfile.lock +0 -44
  77. data/spec/cassettes/google_com.yml +0 -784
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/advertising/admeld')
3
+
4
+ describe Sniffles::Sniffers::Admeld do
5
+ describe "#output", :vcr => { :cassette_name => "wundergroud_com" } do
6
+ let(:admeld) { described_class.new(page_body("http://www.wunderground.com/")) }
7
+ let(:blank) { described_class.new(empty_html_doc) }
8
+
9
+ context "admeld" do
10
+ it { admeld.output[:found].should eq true }
11
+ end
12
+
13
+ context "no admeld" do
14
+ it { blank.output[:found].should eq false }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/advertising/adsense')
3
+
4
+ describe Sniffles::Sniffers::Adsense do
5
+ describe "#output" do
6
+ context "found", :vcr => { :cassette_name => "squidoo_com" } do
7
+ let(:adsense) { described_class.new(page_body("http://www.squidoo.com")) }
8
+
9
+ it { adsense.output[:found].should eq true }
10
+ it { adsense.output[:publisher_id].should eq "ca-pub-9879162776784828" }
11
+ end
12
+
13
+ context "not found" do
14
+ let(:blank) { described_class.new(empty_html_doc) }
15
+
16
+ it { blank.output[:found].should eq false }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/advertising/buysellads')
3
+
4
+ describe Sniffles::Sniffers::Buysellads do
5
+ describe "#output", :vcr => { :cassette_name => "guistyles_com" } do
6
+ context "buysellads" do
7
+ let(:buysellads) { described_class.new(page_body("http://guistyles.com/")) }
8
+
9
+ it { buysellads.output[:found].should eq true }
10
+ end
11
+
12
+ context "no buysellads" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/advertising/casale')
3
+
4
+ describe Sniffles::Sniffers::Casale do
5
+ describe "#output", :vcr => { :cassette_name => "topix_com" } do
6
+ context "casale" do
7
+ let(:casale) { described_class.new(page_body("http://www.topix.com/")) }
8
+
9
+ it { casale.output[:found].should eq true }
10
+ end
11
+
12
+ context "no casale" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/analytics/chartbeat')
3
+
4
+ describe Sniffles::Sniffers::Chartbeat do
5
+ describe "#output", :vcr => { :cassette_name => "foursquare_com" } do
6
+ let(:chartbeat) { described_class.new(page_body("https://foursquare.com")) }
7
+ let(:blank) { described_class.new(empty_html_doc) }
8
+
9
+ context "chartbeat" do
10
+ it { chartbeat.output[:found].should eq true }
11
+ end
12
+
13
+ context "no chartbeat" do
14
+ it { blank.output[:found].should eq false }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/analytics/clicky')
3
+
4
+ describe Sniffles::Sniffers::Clicky do
5
+ describe "#output", :vcr => { :cassette_name => "beenverified_com" } do
6
+ let(:clicky) { described_class.new(page_body("http://www.beenverified.com/")) }
7
+ let(:blank) { described_class.new(empty_html_doc) }
8
+
9
+ context "clicky" do
10
+ it { clicky.output[:found].should eq true }
11
+ end
12
+
13
+ context "no clicky" do
14
+ it { blank.output[:found].should eq false }
15
+ end
16
+ end
17
+ end
@@ -3,43 +3,23 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sni
3
3
 
4
4
  describe Sniffles::Sniffers::GoogleAnalytics do
5
5
  describe "#output" do
6
- context "Inline JS", :vcr do
7
- before(:all) do
8
- @pearsonified = Typhoeus::Request.get("http://www.pearsonified.com/")
9
- @ga = Sniffles::Sniffers::GoogleAnalytics.new(@pearsonified.body)
10
- end
6
+ context "inline js", :vcr => { :cassette_name => "pearsonified_com" } do
7
+ let(:ga) { described_class.new(page_body("http://www.pearsonified.com/")) }
11
8
 
12
- it "should return as found" do
13
- @ga.output[:found].should eq true
14
- end
15
-
16
- it "should return UA" do
17
- @ga.output[:ua].should eq "UA-2916092-1"
18
- end
9
+ it { ga.output[:found].should eq true }
10
+ it { ga.output[:ua].should eq "UA-2916092-1" }
19
11
  end
20
12
 
21
- context "Inline w/ Urchin (Old)" do
22
- before(:all) do
23
- VCR.use_cassette("humemes_com") do
24
- @humemes = Typhoeus::Request.get("http://humemes.com/")
25
- @urchin = Sniffles::Sniffers::GoogleAnalytics.new(@humemes.body)
26
- end
27
- end
28
-
29
- it "should return as found" do
30
- @urchin.output[:found].should eq true
31
- end
13
+ context "inline w/ urchin", :vcr => { :cassette_name => "humemes_com" } do
14
+ let(:ga) { described_class.new(page_body("http://humemes.com/")) }
32
15
 
33
- it "should return UA" do
34
- @urchin.output[:ua].should eq "UA-386965-7"
35
- end
16
+ it { ga.output[:found].should eq true }
17
+ it { ga.output[:ua].should eq "UA-386965-7" }
36
18
  end
37
19
 
38
- context "No Google Analytics" do
39
- it "should return false" do
40
- no_ga = Sniffles::Sniffers::GoogleAnalytics.new("<html><head></head><body>No analytics!</body></html>")
41
- no_ga.output[:found].should eq false
42
- end
20
+ context "no google analytics" do
21
+ let(:blank) { described_class.new(empty_html_doc) }
22
+ it { blank.output[:found].should eq false }
43
23
  end
44
24
  end
45
25
  end
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/analytics/kissmetrics')
3
+
4
+ describe Sniffles::Sniffers::Kissmetrics do
5
+ describe "#output", :vcr => { :cassette_name => "foursquare_com" } do
6
+ let(:kissmetrics) { described_class.new(page_body("https://foursquare.com")) }
7
+ let(:blank) { described_class.new(empty_html_doc) }
8
+
9
+ context "kissmetrics" do
10
+ it { kissmetrics.output[:found].should eq true }
11
+ end
12
+
13
+ context "no kissmetrics" do
14
+ it { blank.output[:found].should eq false }
15
+ end
16
+ end
17
+ end
@@ -2,22 +2,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/analytics/mixpanel')
3
3
 
4
4
  describe Sniffles::Sniffers::Mixpanel do
5
- describe "#output" do
6
- context "w/ Mixpanel", :vcr do
7
- before(:all) do
8
- @squidoo = Typhoeus::Request.get("http://www.squidoo.com").body
9
- end
5
+ describe "#output" do
6
+ context "using mixpanel", :vcr => { :cassette_name => "squidoo_com" } do
7
+ let(:mixpanel) { described_class.new(page_body("http://www.squidoo.com")) }
10
8
 
11
- it "should return UA" do
12
- Sniffles::Sniffers::Mixpanel.new(@squidoo).output[:found].should eq true
13
- end
9
+ it { mixpanel.output[:found].should eq true }
14
10
  end
15
11
 
16
-
17
- context "w/o Mixpanel" do
18
- it "should return false" do
19
- Sniffles::Sniffers::Mixpanel.new("<html><head></head><body>No analytics!</body></html>").output[:found].should eq false
20
- end
12
+ context "not using mixpanel" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
21
16
  end
22
17
  end
23
18
  end
@@ -3,21 +3,16 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sni
3
3
 
4
4
  describe Sniffles::Sniffers::Quantcast do
5
5
  describe "#output" do
6
- context "w/ Quantcast", :vcr do
7
- before(:all) do
8
- @squidoo = Typhoeus::Request.get("http://www.squidoo.com").body
9
- end
6
+ context "quantcast", :vcr => { :cassette_name => 'squidoo_com' } do
7
+ let(:quantcast) { described_class.new(page_body("http://www.squidoo.com")) }
10
8
 
11
- it "should return true for found" do
12
- Sniffles::Sniffers::Quantcast.new(@squidoo).output[:found].should eq true
13
- end
9
+ it { quantcast.output[:found].should eq true }
14
10
  end
15
-
16
11
 
17
- context "w/o Quantcast" do
18
- it "should return false" do
19
- Sniffles::Sniffers::Quantcast.new("<html><head></head><body>No analytics!</body></html>").output[:found].should eq false
20
- end
12
+ context "no quantcast" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
21
16
  end
22
17
  end
23
18
  end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/blogger')
3
+
4
+ describe Sniffles::Sniffers::Blogger do
5
+ describe "#output" do
6
+ context "blogger", :vcr => { :cassette_name => "google_blogspot_com" } do
7
+ let(:blogger) { described_class.new(page_body("http://google.blogspot.com/")) }
8
+
9
+ it { blogger.output[:found].should eq true }
10
+ end
11
+
12
+ context "not blogger" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/cscart')
3
+
4
+ describe Sniffles::Sniffers::Cscart do
5
+ describe "#output" do
6
+ context "cscart", :vcr => { :cassette_name => "demo_cs-cart_com" } do
7
+ let(:cscart) { described_class.new(page_body("http://demo.cs-cart.com/community/")) }
8
+
9
+ it { cscart.output[:found].should eq true }
10
+ end
11
+
12
+ context "not cscart" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/movabletype')
3
+
4
+ describe Sniffles::Sniffers::Movabletype do
5
+ describe "#output" do
6
+ context "movabletype", :vcr => { :cassette_name => "movabletype_com_blog" } do
7
+ let(:movabletype) { described_class.new(page_body("http://www.movabletype.com/blog/")) }
8
+
9
+ it { movabletype.output[:found].should eq true }
10
+ end
11
+
12
+ context "not movabletype" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/oscommerce')
3
+
4
+ describe Sniffles::Sniffers::Oscommerce do
5
+ describe "#output" do
6
+ context "oscommerce", :vcr => { :cassette_name => "demo_oscommerce_com" } do
7
+ let(:oscommerce) { described_class.new(page_body("http://demo.oscommerce.com/")) }
8
+
9
+ it { oscommerce.output[:found].should eq true }
10
+ end
11
+
12
+ context "not oscommerce" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/phpbb')
3
+
4
+ describe Sniffles::Sniffers::Phpbb do
5
+ describe "#output" do
6
+ context "phpBB forum", :vcr => { :cassette_name => "phpbb_com" } do
7
+ let(:phpbb) { described_class.new(page_body("http://www.phpbb.com/styles/demo/3.0/board/?style=0")) }
8
+
9
+ it { phpbb.output[:found].should eq true }
10
+ end
11
+
12
+ context "Not a phpBB Forum" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/posterous')
3
+
4
+ describe Sniffles::Sniffers::Posterous do
5
+ describe "#output" do
6
+ context "posterous", :vcr => { :cassette_name => "blog_posterous_com" } do
7
+ let(:posterous) { described_class.new(page_body("http://blog.posterous.com/")) }
8
+
9
+ it { posterous.output[:found].should eq true }
10
+ end
11
+
12
+ context "not posterous" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/tumblr')
3
+
4
+ describe Sniffles::Sniffers::Tumblr do
5
+ describe "#output" do
6
+ context "tumblr", :vcr => { :cassette_name => "staff_tumblr_com" } do
7
+ let(:tumblr) { described_class.new(page_body("http://staff.tumblr.com")) }
8
+
9
+ it { tumblr.output[:found].should eq true }
10
+ end
11
+
12
+ context "not tumblr" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/vanilla')
3
+
4
+ describe Sniffles::Sniffers::Vanilla do
5
+ describe "#output" do
6
+ context "vanilla", :vcr => { :cassette_name => "forum-software_org_vanilla" } do
7
+ let(:vanilla) { described_class.new(page_body("http://demo.forum-software.org/vanilla/")) }
8
+
9
+ it { vanilla.output[:found].should eq true }
10
+ end
11
+
12
+ context "not vanilla" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/vbulletin')
3
+
4
+ describe Sniffles::Sniffers::Vbulletin do
5
+ describe "#output" do
6
+ context "vbulletin", :vcr => { :cassette_name => "vbulletin_com" } do
7
+ let(:vbulletin) { described_class.new(page_body("https://www.vbulletin.com/forum/forum.php")) }
8
+
9
+ it { vbulletin.output[:found].should eq true }
10
+ it { vbulletin.output[:version].should eq "4.1.11" }
11
+ it { vbulletin.output[:feed].should eq "https://www.vbulletin.com/forum/external.php?type=RSS2" }
12
+ end
13
+
14
+ context "not vbulletin" do
15
+ let(:blank) { described_class.new(empty_html_doc) }
16
+
17
+ it { blank.output[:found].should eq false }
18
+ end
19
+
20
+ end
21
+ end
@@ -1,58 +1,27 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/wordpress')
3
3
 
4
- describe "Sniffers::WordPress" do
5
- context "WordPress Blog w/ feed, theme, and pingback" do
6
- describe "#output", :vcr do
7
- before(:all) do
8
- @pearsonified = Typhoeus::Request.get("http://www.pearsonified.com/").body
9
- @wp = Sniffles::Sniffers::Wordpress.new(@pearsonified)
10
- end
11
-
12
- it "should return found as true" do
13
- @wp.output[:found].should eq true
14
- end
15
-
16
- it "should return feed URI" do
17
- @wp.output[:feed].should eq "http://feeds.feedburner.com/pearsonified"
18
- end
19
-
20
- it "should return theme" do
21
- @wp.output[:theme].should eq "thesis_17"
22
- end
23
-
24
- it "should return pingback URI" do
25
- @wp.output[:pingback].should eq "http://www.pearsonified.com/xmlrpc.php"
26
- end
27
-
28
- it "should return version as false" do
29
- @wp.output[:version].should eq false
30
- end
4
+ describe Sniffles::Sniffers::Wordpress do
5
+ describe "#output" do
6
+ context "feed, theme, pingback", :vcr => { :cassette_name => 'pearsonified_com' } do
7
+ let(:wp) { described_class.new(page_body("http://www.pearsonified.com/")) }
31
8
 
9
+ it { wp.output[:found].should eq true }
10
+ it { wp.output[:feed].should eq "http://feeds.feedburner.com/pearsonified" }
11
+ it { wp.output[:theme].should eq "thesis_17" }
12
+ it { wp.output[:pingback].should eq "http://www.pearsonified.com/xmlrpc.php" }
32
13
  end
33
- end
34
-
35
- context "WordPress Blog w/ version", :vcr do
36
- describe "#output" do
37
- before(:all) do
38
- @humemes = Typhoeus::Request.get("http://humemes.com/").body
39
- @wp_version = Sniffles::Sniffers::Wordpress.new(@humemes)
40
- end
14
+
15
+ context "version", :vcr => { :cassette_name => 'humemes_com' } do
16
+ let(:wp) { described_class.new(page_body("http://humemes.com/")) }
41
17
 
42
- it "should return the version" do
43
- @wp_version.output[:version].should eq "2.3.1"
44
- end
45
- end
46
- end
47
-
48
- context "Not a WordPress Blog", :vcr do
49
- before(:all) do
50
- @google = Typhoeus::Request.get("http://www.google.com/").body
51
- @not_wp = Sniffles::Sniffers::Wordpress.new(@google)
52
- end
18
+ it { wp.output[:version].should eq "2.3.1" }
19
+ end
53
20
 
54
- it "should return false" do
55
- @not_wp.output[:found].should eq false
21
+ context "not wordpress" do
22
+ let(:blank) { described_class.new(empty_html_doc) }
23
+
24
+ it { blank.output[:found].should eq false }
56
25
  end
57
26
  end
58
27
  end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/xenforo')
3
+
4
+ describe Sniffles::Sniffers::Xenforo do
5
+ describe "#output" do
6
+ context "xenforo", :vcr => { :cassette_name => "xenforo_com" } do
7
+ let(:xenforo) { described_class.new(page_body("http://xenforo.com/community/")) }
8
+
9
+ it { xenforo.output[:found].should eq true }
10
+ end
11
+
12
+ context "not xenforo" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/cms/zencart')
3
+
4
+ describe Sniffles::Sniffers::Zencart do
5
+ describe "#output" do
6
+ context "zencart", :vcr => { :cassette_name => "orangecrushbeads_com" } do
7
+ let(:zencart) { described_class.new(page_body("http://orangecrushbeads.com/")) }
8
+
9
+ it { zencart.output[:found].should eq true }
10
+ end
11
+
12
+ context "not zencart" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
16
+ end
17
+ end
18
+ end
@@ -2,24 +2,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/javascript/jquery')
3
3
 
4
4
  describe Sniffles::Sniffers::Jquery do
5
- describe "#output" do
6
- context "w/ jQuery" do
7
- before(:all) do
8
- VCR.use_cassette("squidoo_com") do
9
- @squidoo = Typhoeus::Request.get("http://www.squidoo.com/", :follow_location => true)
10
- end
11
- end
5
+ describe "#output" do
6
+ context "jquery", :vcr => { :cassette_name => "squidoo_com" } do
7
+ let(:jquery) { described_class.new(page_body("http://www.squidoo.com")) }
12
8
 
13
- it "should return true" do
14
- Sniffles::Sniffers::Jquery.new(@squidoo.body).output[:found].should eq true
15
- end
9
+ it { jquery.output[:found].should eq true }
16
10
  end
17
-
18
11
 
19
- context "w/o jQuery" do
20
- it "should return false" do
21
- Sniffles::Sniffers::Jquery.new("<html><head></head><body>No scripts!</body></html>").output[:found].should eq false
22
- end
12
+ context "no jquery" do
13
+ let(:blank) { described_class.new(empty_html_doc) }
14
+
15
+ it { blank.output[:found].should eq false }
23
16
  end
24
17
  end
25
18
  end
@@ -1,34 +1,23 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe Sniffles::Sniffers do
4
- describe "#use", :vcr do
5
- before(:all) do
6
- @wordpress = page_body("http://wordpress.com/")
7
- end
8
-
9
- context "single sniffer", :vcr do
10
- it "should use the passed sniffer" do
11
- output = Sniffles::Sniffers.use(@wordpress, :google_analytics)
12
- output[:found].should be false
13
- end
4
+ describe "#use" do
5
+ context "single sniffer", :vcr => { :cassette_name => "wordpress_com" } do
6
+ let(:wordpress) { page_body("http://wordpress.com/") }
7
+
8
+ it { subject.use(wordpress, :google_analytics).should include(:found) }
14
9
  end
15
10
  end
16
11
 
17
12
  describe "#list_all" do
18
- it "should list all sniffers" do
19
- subject.list_all.count.should eq SNIFFER_COUNT
20
- end
13
+ it { subject.list_all.count.should eq SNIFFER_COUNT }
21
14
  end
22
15
 
23
16
  describe "#list_groups" do
24
- it "should list all groups" do
25
- subject.list_groups.count.should eq SNIFFER_GROUP_COUNT
26
- end
17
+ it { subject.list_groups.count.should eq SNIFFER_GROUP_COUNT }
27
18
  end
28
19
 
29
20
  describe "#list_all_by_group" do
30
- it "should return a hash of all groups with collections of sniffers" do
31
- subject.list_all_by_group.count.should eq SNIFFER_GROUP_COUNT
32
- end
21
+ it { subject.list_all_by_group.count.should eq SNIFFER_GROUP_COUNT }
33
22
  end
34
23
  end