mechanize_content 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/.rvmrc +1 -0
  2. data/Rakefile +5 -0
  3. data/lib/mechanize_content/image.rb +61 -0
  4. data/lib/mechanize_content/page.rb +115 -0
  5. data/lib/mechanize_content/util.rb +4 -31
  6. data/lib/mechanize_content/version.rb +1 -1
  7. data/lib/mechanize_content.rb +8 -168
  8. data/mechanize_content.gemspec +2 -1
  9. data/spec/cassettes/MechanizeContent.yml +33742 -0
  10. data/spec/cassettes/MechanizeContent_Image.yml +279 -0
  11. data/spec/mechanize_content/image_spec.rb +39 -0
  12. data/spec/mechanize_content/page_spec.rb +90 -0
  13. data/spec/mechanize_content_spec.rb +149 -0
  14. data/spec/spec_helper.rb +11 -1
  15. metadata +29 -45
  16. data/spec/fixtures/a-fistful-of-red-dead-redemption-ps3-for-a-few-dollars-less-on.html +0 -754
  17. data/spec/fixtures/another-world-15th-anniversary-edition-now-on-gog-com.html +0 -2416
  18. data/spec/fixtures/another_world_15th_anniversary_edition.html +0 -805
  19. data/spec/fixtures/cmp.html +0 -333
  20. data/spec/fixtures/episodes_from_liberty_city_now_coming_to_playstation_3_and_pc_this_april.html +0 -1593
  21. data/spec/fixtures/gdc_2010_rounds_off_indie_cove.html +0 -698
  22. data/spec/fixtures/google.html +0 -42
  23. data/spec/fixtures/gta-iv-episodes-from-liberty-city-sees-slight-delay-on-pc-and-ps3.html +0 -1012
  24. data/spec/fixtures/johnny.jpg +0 -0
  25. data/spec/fixtures/joystiq-xbox-usb-support-580.jpg +0 -0
  26. data/spec/fixtures/mutiny.html +0 -264
  27. data/spec/fixtures/nuff-said-good-old-games-gets-another-world-168150.html +0 -5492
  28. data/spec/fixtures/rock-band-3-out-this-holiday-will-revolutionize-genre.html +0 -1157
  29. data/spec/fixtures/rockband_facebook.html +0 -93
  30. data/spec/fixtures/spartan.html +0 -391
  31. data/spec/fixtures/techmeme.html +0 -2216
  32. data/spec/fixtures/time-warner-retail-egm.html +0 -49
  33. data/spec/fixtures/witcher.html +0 -458
  34. data/spec/fixtures/xbox-360-gaining-usb-storage-support-in-2010-update.html +0 -2462
  35. data/spec/mechanize-content_spec.rb +0 -202
@@ -0,0 +1,279 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://media.giantbomb.com:80/uploads/8/82135/1655259-background_black_v3_middle.jpg
6
+ body:
7
+ headers:
8
+ referer:
9
+ - http://splitstate.com
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ x-amz-id-2:
16
+ - sqo07dmpz5IvD5DG5XrEpL/uDl/nA28DKeyTl81r2JsRexATnq7Y660CFx2jVC+B
17
+ x-amz-request-id:
18
+ - 5EA19F1DAE6FC021
19
+ date:
20
+ - Fri, 27 May 2011 22:30:30 GMT
21
+ cache-control:
22
+ - max-age=315360000, public
23
+ expires:
24
+ - Thu, 31 Dec 2037 23:55:55 GMT
25
+ last-modified:
26
+ - Fri, 27 May 2011 21:17:36 GMT
27
+ etag:
28
+ - "\"b075f6409bd435cadad832211e97a8ca\""
29
+ accept-ranges:
30
+ - bytes
31
+ content-type:
32
+ - image/jpeg
33
+ content-length:
34
+ - "10437"
35
+ server:
36
+ - AmazonS3
37
+ age:
38
+ - "128322"
39
+ x-cache:
40
+ - Hit from cloudfront
41
+ x-amz-cf-id:
42
+ - 039fc8c57ad630d79423e73698def66e69b5737575f655aafe9d55fb9d623a02364c95028dbafdc8
43
+ via:
44
+ - 1.0 227087338674ca3d3d23a79539f2998b.cloudfront.net:11180 (CloudFront), 1.0 c27ac78e369067481a204547ae56aef7.cloudfront.net:11180 (CloudFront)
45
+ body: !binary |
46
+ /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsL
47
+ DBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKD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0e0tmtxZpeTHh7l1UsT9W6D2GBWJr80N1o0c8EIhM8s
263
+ kgjAAG1QiLwB1zn9ado2jC1PnTeXLdH7uBuC/QetZk07T3On2k+5FVkRmcYG
264
+ C5c/nkcU0lfQpy01PcNEhSx0eztEkiPkQIhwc8gDP60V5+zHnbJg/WiuR0ru
265
+ 9zb2ttLHn6arLGfkldc+hpP7TcNuDc+vesLzDR5h9a9H2aPP9ozdGqMHDk7i
266
+ PU1bj10fxZX6ciuX8w+tHmGk6SY/as67+3yFwkuzjggdKVNelXObtmJ9q5Dz
267
+ D60vmNS9kg9qzrG16RlK+ewzxuOM1UfUZSpBm3LXPea3rS+c3rT9mg9qzc+1
268
+ oT1z6n1pXvVl28lQvA24H8qwvNajzmp+zD2jOkh1J48r9okVSckA5BPTkHrT
269
+ 11IKxKsMnuoxXMec1L5zetHJcXtGdVHq+w8H86eNbfG3zBt61yXnN60nnN60
270
+ vZIftGdc2tEg5kznrzUTatkgh2B7YNct5zetHnN60ezQvaM6tdaaNi6yMCTk
271
+ 4NIdZdmL7sfTpXK+e/rR5retPkDnOrXWHU7gw9gOtB1guNxdQfQ81ynnN60e
272
+ c3rR7NB7RnVprXG3d8vUD0p6655Z3L94dMGuR85vWjzW9aPZoPaHW/8ACRXL
273
+ fN5zA5+4eR+VH9uvIhTKDPUAYwfzrkvNYdzSea3rRyK9xc7Ot/tvZ0xx60su
274
+ uefbsGKqEAA2jFcl5retHnNtIzxUujFle1ZqG9OSR3qNLrzLmLdyqsGP4HNZ
275
+ m8+tCuQavkRPOzs/7c561zcc+JH9yf51T89/U0zec5zSjBIbm2a0l6VjABzU
276
+ um3awF5T/rGOM+1Ym84xTllKjAp8mgudnVNrTLGcMc9uayxqk095E8zGQJKX
277
+ 5HIJP/1hWSZWIxmkEhBJ9aSgkN1G1Y6/+2z/AHqK5Lzm9aKXskP2jP/Z
278
+
279
+ http_version: "1.0"
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe MechanizeContent::Image do
4
+ use_vcr_cassette :record => :new_episodes
5
+
6
+ describe "#interesting_css?" do
7
+ context "given a gif" do
8
+ it "is not interesting" do
9
+ img = {"src" => "http://www.cmpevents.com/GD10/ablank.gif2", "width" => 500, "height" => 500}
10
+ image = MechanizeContent::Image.new(img, "https://www.cmpevents.com")
11
+ image.should_not be_interesting_css
12
+ end
13
+ end
14
+
15
+ context "given a banner" do
16
+ it "is not interesting" do
17
+ img = {"src" => "http://www.cmpevents.com/GD10/banner.png", "width" => 500, "height" => 500}
18
+ image = MechanizeContent::Image.new(img, "https://www.cmpevents.com")
19
+ image.should_not be_interesting_css
20
+ end
21
+ end
22
+
23
+ context "given a small image" do
24
+ it "is not interesting" do
25
+ img = {"src" => "http://www.cmpevents.com/GD10/toosmall.png", "width" => 64, "height" => 500}
26
+ image = MechanizeContent::Image.new(img, "https://www.cmpevents.com")
27
+ image.should_not be_interesting_css
28
+ end
29
+ end
30
+
31
+ context "given a well sized non advertising image" do
32
+ it "is valid" do
33
+ img = {"src" => "http://media.giantbomb.com/uploads/8/82135/1655259-background_black_v3_middle.jpg", "width" => 500, "height" => 500}
34
+ image = MechanizeContent::Image.new(img, "http://www.giantbomb.com/news/to-congress-from-sony-we-still-dont-know-who-hacked-us-dont-believe-credit-card-data-taken/3273/")
35
+ image.should be_interesting_css
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,90 @@
1
+ require 'spec_helper'
2
+
3
+ describe MechanizeContent::Page do
4
+ use_vcr_cassette "MechanizeContent", :record => :new_episodes
5
+
6
+ describe "#base_url" do
7
+ context "given a page" do
8
+ it "will have a base url" do
9
+ mc = MechanizeContent::Page.new("http://www.mutinydesign.co.uk/scripts/html-base-tag---1/")
10
+ mc.base_url.to_s.should eql("http://www.mutinydesign.co.uk")
11
+ end
12
+ end
13
+ end
14
+
15
+ describe "#image" do
16
+ context "given a page with content" do
17
+ it "will find an image" do
18
+ mc = MechanizeContent::Page.new("http://www.rockstargames.com/newswire/article/16021/street-crimes-of-la-noire-new-screenshots-info.html")
19
+ mc.image.should eql("http://media.rockstargames.com/rockstargames/img/global/news/upload/lanoire_streetcrimes_cameraobscura.jpg")
20
+ end
21
+ end
22
+
23
+ context "given a page with no image" do
24
+ it "will not find an image" do
25
+ mc3 = MechanizeContent::Page.new("http://www.gog.com/en/gamecard/another_world_15th_anniversary_edition")
26
+ mc3.image.should eql(nil)
27
+ end
28
+ end
29
+
30
+ context "given a page with no content" do
31
+ it "will not find an image" do
32
+ mc4 = MechanizeContent::Page.new("http://www.gog.com/page_has_no_content")
33
+ mc4.stub!(:fetch_content).and_return(nil)
34
+ mc4.image.should eql(nil)
35
+ end
36
+ end
37
+
38
+ context "given a page with an image" do
39
+ it "will find the image" do
40
+ mc5 = MechanizeContent::Page.new("http://www.egmnow.com/press/time-warner-retail-egm.html")
41
+ mc5.image.should eql("http://www.egmnow.com/images/egmlogo.jpg")
42
+ end
43
+ end
44
+ end
45
+
46
+ describe "#fetch_content" do
47
+ context "given an error in fetching the page" do
48
+ it "has no content" do
49
+ mc2 = MechanizeContent::Page.new("http://somewherelse.com/")
50
+ agent = mock("agent")
51
+ page = mock("page")
52
+ page.stub!(:class).and_return(Mechanize::Page)
53
+ agent.should_receive(:get).with("http://somewherelse.com/").and_raise(Errno::ECONNRESET)
54
+ mc2.should_receive(:agent).any_number_of_times.and_return(agent)
55
+ mc2.fetch_content.should eql(nil)
56
+ end
57
+ end
58
+ context "given the page timeouts" do
59
+ it "has no content" do
60
+ mc = MechanizeContent::Page.new("http://techmeme.com/")
61
+ agent = mock("agent")
62
+ page = mock("page")
63
+ page.stub!(:class).and_return(Mechanize::Page)
64
+ agent.should_receive(:get).with("http://techmeme.com/").and_raise(Timeout::Error)
65
+ mc.should_receive(:agent).any_number_of_times.and_return(agent)
66
+ mc.fetch_content.should eql(nil)
67
+ end
68
+ end
69
+ context "given the page is not available" do
70
+ it "has no content" do
71
+ mc = MechanizeContent::Page.new("http://techmeme.com/")
72
+ agent = mock("agent")
73
+ page = mock("page")
74
+ mc.stub!(:agent).and_return(agent)
75
+ page.stub!(:code).and_return(400)
76
+ agent.should_receive(:get).with("http://techmeme.com/").and_return(page)
77
+ mc.fetch_content.should eql(nil)
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "#text" do
83
+ context "given a page with content" do
84
+ it "will find some text" do
85
+ mc2 = MechanizeContent::Page.new("http://www.gamesetwatch.com/2010/03/gdc_2010_rounds_off_indie_cove.php")
86
+ mc2.text.should eql("Game Developers Conference organizers have confirmed the final set of independent game-specific content, including Ron Carmel on the just-debuted Indie Fund, the Gamma IV party/showcase, and the EGW-replacing Nuovo Sessions game showcase.The newly confirmed details round off a multitude of independent game-specific content at the March 9th-13th event, held at the Moscone Center in San Francisco, including the 12th Annual Independent Games Festival -- featuring over 30 top indie games playable on the GDC Expo floor from Thursday 11th to Saturday 13th, as well as the major IGF Awards on Thursday 11th at 6.30pm.In addition, the 4th Independent Games Summit on Tuesday 9th and Wednesday 10th has added and clarified a number of sessions, with 2D Boy's Ron Carmel kicking off the event with 'Indies and Publishers: Fixing a System That Never Worked', now confirmed to discuss the new Indie Fund organization.Another major new panel, 'Tripping The Art Fantastic', features Spelunky creator Derek Yu, Braid artist David Hellman and Super Meat Boy co-creator Edmund McMillen discussing \"how each one of these figures influences the state of game art, from hand painted epics to short form experimental Flash games.\"")
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,149 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
+
4
+ describe "MechanizeContent" do
5
+ use_vcr_cassette :record => :new_episodes
6
+
7
+ describe "#best_title" do
8
+ context "given a page with a title" do
9
+ it "will be that title" do
10
+ mc = MechanizeContent::Parser.new("http://techmeme.com/")
11
+ mc.best_title.should eql("Techmeme")
12
+ end
13
+ end
14
+
15
+ context "given the page has an incorrect class" do
16
+ it "will be the url" do
17
+ p = MechanizeContent::Page.new("http://techmeme.com/")
18
+ p.stub!(:agent => double("agent", :get => double("p")))
19
+ MechanizeContent::Page.stub!(:new => p)
20
+ mc = MechanizeContent::Parser.new("http://techmeme.com/")
21
+ mc.best_title.should eql("http://techmeme.com/")
22
+ end
23
+ end
24
+
25
+ context "given page has no title" do
26
+ it "will be the url" do
27
+ p = mock("page", :title => nil, :url => "http://techmeme.com/")
28
+ MechanizeContent::Page.stub!(:new => p)
29
+ mc = MechanizeContent::Parser.new("http://techmeme.com/")
30
+ mc.best_title.should eql("http://techmeme.com/")
31
+ end
32
+ end
33
+
34
+ context "given multiple urls are passed in" do
35
+ it "will find the best title" do
36
+ mc = MechanizeContent::Parser.new("http://www.facebook.com/RockBand", "http://www.vg247.com/2010/03/09/rock-band-3-out-this-holiday-will-revolutionize-genre/")
37
+ mc.best_title.should eql("Rock Band | Facebook")
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ describe "#best_text" do
44
+ context "page with no text" do
45
+ it "will be nil" do
46
+ mc = MechanizeContent::Parser.new("https://www.cmpevents.com/GD10/a.asp?option=C&V=11&SessID=10601")
47
+ mc.best_text.should eql(nil)
48
+ end
49
+ end
50
+
51
+ context "given a page with text" do
52
+ it "will be the text" do
53
+ mc2 = MechanizeContent::Parser.new("http://www.gamesetwatch.com/2010/03/gdc_2010_rounds_off_indie_cove.php")
54
+ mc2.best_text.should eql("Game Developers Conference organizers have confirmed the final set of independent game-specific content, including Ron Carmel on the just-debuted Indie Fund, the Gamma IV party/showcase, and the EGW-replacing Nuovo Sessions game showcase.The newly confirmed details round off a multitude of independent game-specific content at the March 9th-13th event, held at the Moscone Center in San Francisco, including the 12th Annual Independent Games Festival -- featuring over 30 top indie games playable on the GDC Expo floor from Thursday 11th to Saturday 13th, as well as the major IGF Awards on Thursday 11th at 6.30pm.In addition, the 4th Independent Games Summit on Tuesday 9th and Wednesday 10th has added and clarified a number of sessions, with 2D Boy's Ron Carmel kicking off the event with 'Indies and Publishers: Fixing a System That Never Worked', now confirmed to discuss the new Indie Fund organization.Another major new panel, 'Tripping The Art Fantastic', features Spelunky creator Derek Yu, Braid artist David Hellman and Super Meat Boy co-creator Edmund McMillen discussing \"how each one of these figures influences the state of game art, from hand painted epics to short form experimental Flash games.\"")
55
+ end
56
+ end
57
+
58
+ context "given multiple urls are passed in" do
59
+ it "will find the best text" do
60
+ mc = MechanizeContent::Parser.new("http://www.facebook.com/RockBand", "http://www.vg247.com/2010/03/09/rock-band-3-out-this-holiday-will-revolutionize-genre/")
61
+ mc.best_text.should include("Harmonix just confirmed that Rock Band 3 will release this holiday season.Said the firm on Rock Band’s Facebook page:“Harmonix is developing Rock Band 3 for worldwide release this holiday season! The game, which will be published by MTV Games and distributed by Electronic Arts, will innovate and revolutionize the music genre once again, just as Harmonix did with the original Rock Band, Rock Band 2 and The Beatles: Rock Band. Stay tuned for more details!”There’s no more detail right now, but keep watching for updates from GDC.")
62
+ end
63
+ end
64
+
65
+ context "given the first link has no text" do
66
+ it "will pull text from the next link" do
67
+ mc = MechanizeContent::Parser.new("http://www.gog.com/en/gamecard/another_world_15th_anniversary_edition", "http://www.destructoid.com/-nuff-said-good-old-games-gets-another-world-168150.phtml", "http://www.joystiq.com/2010/03/18/another-world-15th-anniversary-edition-now-on-gog-com/")
68
+ mc.best_text.should eql("Éric Chahi masterpiece is looking better than ever\r\r\rPosted on 2010-03-18 09:46:36 by \r\rEclipse:\r\rThe first time I've ever played Another World was on my 486, I remember I booted up the game and wow, I was so shocked at how "cinematic" it felt, it looked and played like an animated sci-fi movie, fluid animations, always unique enemies, action puzzles... I remember it was the first game I've ever played that needed you to actually run away from the beast atread more\r the end of the first level instead of just shooting the hell out of your enemies. The world around Lester felt more alive than every game I've ever played before and Lester himself was a true human, not some sort of pumped superdude with a shotgun.Smooth animations like I was never able to see from Prince of Persia times, glorious and fascinating graphics, rapid action sequences and an hard yet satisfying gameplay.When I played this remade version for the first time I had a similar feeling, It wasn't something new, I've played this game dozen of times during years, but the sharp vector graphics i was able too see as child on my old crt monitor looked pixelly on my new 23" LCD, this restyle reminds me more than the original version how I used to look at this game, I know it may sound strange but it's true.And yay, no more passwords to remember :)This game made my childhood and it's one of the best games EVER.\r\r\r\rWas this helpful?\r\r\r(105 of 119 people found this helpful)")
69
+ end
70
+ end
71
+
72
+ context "given a page with strange class names" do
73
+ it "should still be able to find the text" do
74
+ mc = MechanizeContent::Parser.new("http://www.destructoid.com/-nuff-said-good-old-games-gets-another-world-168150.phtml")
75
+ mc.best_text.should eql("Another World -- or Out of this World, as many of you will know it by -- is now on DRM-free digital distribution service Good Old Games. It can be had for $9.99. Need I say more?\rI love the game, even though I have never made it more than oh, five minutes in. It's more or less universally loved by the Destructoid staff. Not long after we got an email detailing the good news, the thread soon reached fifteen or so replies full of praise for the game.\rOther, less exciting recent releases include: Empire Earth II Gold, Gabriel Knight 3, and Aquanox. Not to completely s**t on these games, but this is Another World we're talking about here.")
76
+ end
77
+ end
78
+
79
+ context "given a flash marketing micro site" do
80
+ it "will be nil" do
81
+ mc = MechanizeContent::Parser.new("http://www.sonypictures.co.uk/movies/cloudywithachanceofmeatballs/")
82
+ mc.best_text.should eql(nil)
83
+ end
84
+ end
85
+
86
+ context "given a first page with text that is too short" do
87
+ it "will pull text from the next suitable page" do
88
+ mc = MechanizeContent::Parser.new("http://www.examiner.com/fps-in-national/playstation-network-up-japan-video-announcement-video",
89
+ "http://www.vg247.com/2011/05/28/sony-brings-psn-back-online-in-japan/",
90
+ "http://kotaku.com/5806527/oh-yeah--playstation-network-is-back-online-in-japan")
91
+ mc.best_text.should eq("Sony has announced that it has brought PlayStation Network services back online in Japan.After announcing a phased restoration of PSN and Qriocity Services in Japan and Asian countries and regions including Taiwan, Singapore, Malaysia, Indonesia, and Thailand yesterday, the firm has released a video of Sony president Kaz Harai revealing the service being brought back online.It’s posted below. But he is speaking in Japanese and there are no subtitles – just so you know. Yesterday, Sony also announced its plans for increased security measures in the region, which will “strengthen [and] safeguard against unauthorized activity, and provide consumers with greater protection of their personal information.”As an additional measure, a Chief Information Security Officer was created at SNEI who will work to reinforce overall information security across the company’s network infrastructure.“I’d also like to send my sincere regret to customers in Japan and Asian countries and regions for the inconvenience these events have caused you,” said Hirai. “We are taking aggressive action including increasing security measures and working with respective authorities to address the concerns that were raised by this incident.“We are making consumer data protection a full-time, company wide commitment so that our customers can rest assured about enjoying their entertainment.”The first phase of restored services for these countries and regions will include:Sign-in for PlayStationNetwork and Qriocity services, including the resetting of passwordsRestoration of online game-play across PS3 and PSP‘Friends’ category on PS3, including Friends List, Chat Functionality, Trophy Comparison, etc.PlayStation HomeAccess to other network features on services such as torne.(Customers will not be able to download movies rented through PlayStation Network video download service because movies have expired as a result of PlayStation Network service being turned off since April 21 (JST).)Thanks, Examiner. Related postsPlayStation Japan relief effort brings in $1.3 millionSeason One tester brings Tribbles to Star Trek OnlineSony Japan reveals Dress 2 Posted in: Japan, PSN, Sony Tags: kaz hirai, psn services")
92
+ end
93
+ end
94
+ end
95
+
96
+ describe "#best_image" do
97
+ context "given a page with a suitable image" do
98
+ it "will be the image url" do
99
+ mc = MechanizeContent::Parser.new("http://www.rockstargames.com/newswire/article/16021/street-crimes-of-la-noire-new-screenshots-info.html")
100
+ mc.best_image.should eql("http://media.rockstargames.com/rockstargames/img/global/news/upload/lanoire_streetcrimes_cameraobscura.jpg")
101
+ end
102
+ end
103
+
104
+ context "given a page with no suitable images" do
105
+ it "will be nil" do
106
+ mc3 = MechanizeContent::Parser.new("http://www.gog.com/en/gamecard/another_world_15th_anniversary_edition")
107
+ mc3.best_image.should eql(nil)
108
+ end
109
+ end
110
+
111
+ context "given multiple urls are passed in" do
112
+ it "will find the best image" do
113
+ mc = MechanizeContent::Parser.new("http://www.facebook.com/RockBand", "http://www.vg247.com/2010/03/09/rock-band-3-out-this-holiday-will-revolutionize-genre/")
114
+ mc.best_image.should eql("http://assets.vg247.com/current//2010/03/rockbandlogo.jpg")
115
+ end
116
+ end
117
+
118
+ context "given the first pick does not support hot linking" do
119
+ it "will fall back to the next image" do
120
+ mc = MechanizeContent::Parser.new("http://www.andriasang.com/e/blog/2011/05/27/kojima_questions/",
121
+ "http://www.joystiq.com/2011/05/27/kojima-something-big-planned-for-25th-metal-gear-anniversary-ne/",
122
+ "http://www.giantbomb.com/news/hideo-kojima-smacks-down-rumors-spreads-disappointment-ahead-of-e3/3272/",
123
+ "http://www.vg247.com/2011/05/27/kojima-no-mgs5-at-e3-ngp-project-isnt-mgs4-port/",
124
+ "http://www.1up.com/news/kojima-planning-something-big-metal-gear-anniversary")
125
+ mc.best_image.should == "http://media.giantbomb.com/uploads/0/91/233021-2368273836_4080f1e08e_o_middle.jpg"
126
+ end
127
+ end
128
+ end
129
+
130
+ describe ".initialize" do
131
+ context "given an array of urls are passed in" do
132
+ it "will still parse content" do
133
+ mc = MechanizeContent::Parser.new(["http://www.rockstargames.com/newswire/article/16021/street-crimes-of-la-noire-new-screenshots-info.html", "http://www.vg247.com/2010/03/18/gta-iv-episodes-from-liberty-city-sees-slight-delay-on-pc-and-ps3/"])
134
+ mc.best_title.should eql("Street Crimes of L.A. Noire: New Screenshots & Info | Rockstar Games")
135
+ mc.best_text.should eql(" Two women describe their encounter with a pervert to Detective Phelps in \"Camera Obscura\", one of many street crimes you'll encounter while exploring the city in L.A. Noire.\rIn addition to all of the desk cases you'll tackle as Cole Phelps as part of the main story of L.A. Noire, you'll also have the opportunity to bring wayward miscreants to justice and protect and serve the city of Los Angeles by solving Street Crimes. Pay attention to your police radio as you're driving around the city of L.A., requests for help will be broadcast to your squad car, and an icon will appear on your map. More and more Street Crimes will become unlocked as you progress through the game, solving them all will earn you 'The Long Arm of the Law' Achievement/Trophy.\rCheck out new screens from just a few of the incidents you'll encounter on the streets of Los Angeles below, which can also be seen in high definition at the official L.A. Noire site Screenshots section.\r A pair of novice criminals attempt to pull off a jewelry store heist in \"Amateur Hour.\"\r Chase down the armed suspects responsible for shooting this patrol officer in the \"Cop Killer Shot\" case.\r Phelps and Bekowsky encounter a man on the sidewalk that been robbed of everything - even his footwear - in the \"Shoo-Shoo Bandits\" Street Crimes case.\rPreviously:L.A. Noire Character Dossier & New Screens: Mickey CohenScreens from L.A. Noire Crime Desk #4 of 5: ViceCandy Edwards - L.A. Noire Character Dossier & New Screens")
136
+ mc.best_image.should eql("http://media.rockstargames.com/rockstargames/img/global/news/upload/lanoire_streetcrimes_cameraobscura.jpg")
137
+ end
138
+ end
139
+
140
+ context "given urls are passed in as seperate arguements" do
141
+ it "will parse arguements" do
142
+ mc = MechanizeContent::Parser.new("http://www.rockstargames.com/newswire/article/16021/street-crimes-of-la-noire-new-screenshots-info.html", "http://www.vg247.com/2010/03/18/gta-iv-episodes-from-liberty-city-sees-slight-delay-on-pc-and-ps3/")
143
+ mc.best_title.should eql("Street Crimes of L.A. Noire: New Screenshots & Info | Rockstar Games")
144
+ mc.best_text.should eql(" Two women describe their encounter with a pervert to Detective Phelps in \"Camera Obscura\", one of many street crimes you'll encounter while exploring the city in L.A. Noire.\rIn addition to all of the desk cases you'll tackle as Cole Phelps as part of the main story of L.A. Noire, you'll also have the opportunity to bring wayward miscreants to justice and protect and serve the city of Los Angeles by solving Street Crimes. Pay attention to your police radio as you're driving around the city of L.A., requests for help will be broadcast to your squad car, and an icon will appear on your map. More and more Street Crimes will become unlocked as you progress through the game, solving them all will earn you 'The Long Arm of the Law' Achievement/Trophy.\rCheck out new screens from just a few of the incidents you'll encounter on the streets of Los Angeles below, which can also be seen in high definition at the official L.A. Noire site Screenshots section.\r A pair of novice criminals attempt to pull off a jewelry store heist in \"Amateur Hour.\"\r Chase down the armed suspects responsible for shooting this patrol officer in the \"Cop Killer Shot\" case.\r Phelps and Bekowsky encounter a man on the sidewalk that been robbed of everything - even his footwear - in the \"Shoo-Shoo Bandits\" Street Crimes case.\rPreviously:L.A. Noire Character Dossier & New Screens: Mickey CohenScreens from L.A. Noire Crime Desk #4 of 5: ViceCandy Edwards - L.A. Noire Character Dossier & New Screens")
145
+ mc.best_image.should eql("http://media.rockstargames.com/rockstargames/img/global/news/upload/lanoire_streetcrimes_cameraobscura.jpg")
146
+ end
147
+ end
148
+ end
149
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,13 @@
1
1
  require 'mechanize_content'
2
2
  require "fakeweb"
3
- FakeWeb.allow_net_connect = false
3
+ require 'vcr'
4
+
5
+ VCR.config do |c|
6
+ c.cassette_library_dir = 'spec/cassettes'
7
+ c.stub_with :fakeweb
8
+ c.default_cassette_options = { :record => :new_episodes }
9
+ end
10
+
11
+ RSpec.configure do |c|
12
+ c.extend VCR::RSpec::Macros
13
+ end