libcraigscrape 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,13 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe CraigScrape::Listings do
5
+ let(:end_of_2012) { Time.local(2012,12,31) }
6
+ let(:start_of_2013) { Time.local(2013,1,20) }
7
+
5
8
  context "listing_cta_ftl_112612.html" do
9
+ before{ Timecop.freeze(start_of_2013) }
10
+ after{ Timecop.return }
11
+
6
12
  subject { described_class.new( uri_for('listing_cta_ftl_112612.html') ) }
7
13
  specify{ subject.posts.should have(100).items }
8
14
  specify{ subject.posts.collect(&:post_date).uniq.should eq([Date.strptime('11/26/2012', '%m/%d/%Y')]) }
@@ -27,6 +33,9 @@ describe CraigScrape::Listings do
27
33
  end
28
34
 
29
35
  context 'listing_search_ppa_nyc_121212.html' do
36
+ before{ Timecop.freeze(end_of_2012) }
37
+ after{ Timecop.return }
38
+
30
39
  subject { described_class.new( uri_for('listing_search_ppa_nyc_121212.html') ) }
31
40
 
32
41
  specify{ subject.posts.should have(100).items }
@@ -53,6 +62,9 @@ describe CraigScrape::Listings do
53
62
  end
54
63
 
55
64
  context "listing_rea_miami_123012.html" do
65
+ before{ Timecop.freeze(end_of_2012) }
66
+ after{ Timecop.return }
67
+
56
68
  subject { described_class.new( uri_for('listing_rea_miami_123012.html') ) }
57
69
  specify{ subject.posts.should have(100).items }
58
70
  specify{ subject.posts[0].attributes.should eq({
@@ -20,6 +20,7 @@ describe CraigScrape::Posting do
20
20
  its(:posting_id) {should eq(3469913065)}
21
21
  its(:reply_to) {should eq('9cxgv-3469913065@sale.craigslist.org')}
22
22
  its(:post_time) {should eq(DateTime.parse('2012-12-10 20:51:00 -0500'))}
23
+ its(:post_date) {should eq(Date.parse('2012-12-10'))}
23
24
  its(:price) {should eq(480)}
24
25
  its(:images) {should eq([])}
25
26
  its(:pics) do
@@ -46,6 +47,7 @@ describe CraigScrape::Posting do
46
47
  its(:posting_id) {should eq(3469905497)}
47
48
  its(:reply_to) {should eq('z7jmh-3469905497@sale.craigslist.org')}
48
49
  its(:post_time) {should eq(DateTime.parse('2012-12-10 20:47:00 -0500'))}
50
+ its(:post_date) {should eq(Date.parse('2012-12-10'))}
49
51
  its(:price) {should eq(80)}
50
52
  its(:images) do
51
53
  images_list = ["http://i1157.photobucket.com/albums/p590/emy123000/T2eC16NE9s2fp7dBQuCykypg60_12.jpg", "http://i1157.photobucket.com/albums/p590/emy123000/KGrHqZqwFCS4TIRoZBQKvdVJIQ60_57.jpg", "http://i1157.photobucket.com/albums/p590/emy123000/KGrHqZqwFCS4TIRoZBQKvdVJIQ60_57.jpg", "http://i1157.photobucket.com/albums/p590/emy123000/ScreenShot2012-06-25at60811AM.png", "http://i1157.photobucket.com/albums/p590/emy123000/KGrHqZowFCp4FZqoWBQvsVUbFdw60_12.jpg"]
@@ -71,6 +73,7 @@ describe CraigScrape::Posting do
71
73
  its(:posting_id) {should eq(3437079882)}
72
74
  its(:reply_to) {should eq(nil)}
73
75
  its(:post_time) {should eq(DateTime.parse('2012-11-26 21:34:00 -0500'))}
76
+ its(:post_date) {should eq(Date.parse('2012-11-26'))}
74
77
  its(:price) {should eq(8500)}
75
78
  its(:images) {should eq([])}
76
79
  its(:pics) do
@@ -94,6 +97,7 @@ describe CraigScrape::Posting do
94
97
  its(:posting_id) {should eq(3431080802)}
95
98
  its(:reply_to) {should eq('rbwts-3431080802@sale.craigslist.org')}
96
99
  its(:post_time) {should eq(DateTime.parse('2012-12-05 21:25:00 -0500'))}
100
+ its(:post_date) {should eq(Date.parse('2012-12-05'))}
97
101
  its(:price) {should eq(nil)}
98
102
  its(:images) {should eq([])}
99
103
  its(:pics) {should eq(["http://images.craigslist.org/3Kb3M83I85Gc5Ea5H2cbo8eb0fb5e4af71968.jpg", "http://images.craigslist.org/3Lb3M33l35E85F35P0cbod80bd9115e311350.jpg", "http://images.craigslist.org/3Ef3Ib3H55L35K55J6cbof57b4d73878111d0.jpg"])}
@@ -113,6 +117,7 @@ describe CraigScrape::Posting do
113
117
  its(:posting_id) {should eq(3448282416)}
114
118
  its(:reply_to) {should eq('nqmhm-3448282416@sale.craigslist.org')}
115
119
  its(:post_time) {should eq(DateTime.parse('2012-12-01 15:02:00 -0500'))}
120
+ its(:post_date) {should eq(Date.parse('2012-12-01'))}
116
121
  its(:price) {should eq(2)}
117
122
  its(:images) {should eq([])}
118
123
  its(:pics) {should eq(["http://images.craigslist.org/3I93pe3Hf5G75J55M2cc13e19b59314771029.jpg"])}
@@ -133,6 +138,7 @@ describe CraigScrape::Posting do
133
138
  its(:posting_id) {should eq(3438004368)}
134
139
  its(:reply_to) {should eq('p7h8m-3438004368@hous.craigslist.org')}
135
140
  its(:post_time) {should eq(DateTime.parse('2012-12-05 12:46:00 -0500'))}
141
+ its(:post_date) {should eq(Date.parse('2012-12-05'))}
136
142
  its(:price) {should eq(1149000)}
137
143
  its(:images) {should eq([])}
138
144
  its(:pics) {should eq(["http://images.craigslist.org/3M43Jb3ld5L55Z35M5cbr12a6ec99f72d18e2.jpg", "http://images.craigslist.org/3L73H63l45I55L35G4cbr8902484988f3112f.jpg", "http://images.craigslist.org/3Le3Ic3Hf5I75La5M1cbrdd1617f48d4c1f02.jpg"])}
@@ -153,5 +159,62 @@ describe CraigScrape::Posting do
153
159
  its(:posting_id) {should eq(3456070558)}
154
160
  its(:reply_to) {should eq('qnggz-3456070558@comm.craigslist.org')}
155
161
  its(:post_time) {should eq(DateTime.parse('2012-12-26 17:41:00 PST'))}
162
+ its(:post_date) {should eq(Date.parse('2012-12-26'))}
163
+ end
164
+
165
+ context "posting_hil_cto_011913.html" do
166
+ # This example was picked since we were failing to parse the post_date:
167
+ subject{ described_class.new uri_for('posting_hil_cto_011913.html') }
168
+
169
+ its(:post_date) {should eq(Date.parse('2013-01-08'))}
170
+ its(:full_section) {should eq([ 'tampa bay', 'hillsborough co',
171
+ 'all for sale / wanted', 'cars & trucks - by owner' ])}
172
+
173
+ its(:header) {should eq("2 dr Chevy on 30s fs/trade donk - $20 (Any)")}
174
+ its(:label) {should eq("2 dr Chevy on 30s fs/trade donk - $20")}
175
+ its(:title) {should eq("2 dr Chevy on 30s fs/trade donk - $20 (Any)")}
176
+
177
+ its(:location) {should eq('Any')}
178
+ its(:posting_id) {should eq(3516252529)}
179
+ its(:reply_to) {should eq('t5kjj-3516252529@sale.craigslist.org')}
180
+ its(:post_time) {should eq(DateTime.parse('2013-01-08, 2:09PM EST'))}
181
+ its(:post_date) {should eq(Date.parse('2013-01-08'))}
182
+
183
+ its(:price) {should eq(20)}
184
+ its(:images) {should eq([])}
185
+ its(:pics) {should eq(["http://images.craigslist.org/3G53I93Hc5L85Kf5H7d120fddd0157c831762.jpg", 'http://images.craigslist.org/3F83J73Hb5L75Gb5J2d12f3a7aa165da01cad.jpg', 'http://images.craigslist.org/3I43m13N85K25Fd5Hed120641f1962feb153b.jpg', 'http://images.craigslist.org/3Ld3J53H35Gb5Ff5Jfd12984fcb8d2d721dd9.jpg'])}
186
+ its(:img_types) {should eq([:pic])}
187
+
188
+ its(:contents) {should eq("One of the baddest 2 door chevys u will ever see on the road way way to much to list car is in Paint shop now getting painted house of color real candy red all the way through the car everything on car is brand new from the motor (no other one like it) and to the lift (done by underground rim king) fiberglass digital dash this is a one of a kind only car I have ever seen with a see through hood on it car has everything I want 20,000 cash or close to it but.... I will trade for either one of the following: a tahoe, or pick up,hummer h2,silver ado, Sierra,Dually, range rover,porsche suv,avalanche,magnum,charger,cls 500,745,range rover,infinity of any kind im open just send me a text or email either one is good or a vert!!! I will drive to u or meet u half way o yea and the rims are 30's floaters (786)257-7215 Cj text me<br><br><br><br><br>\nDonk,floaters,trade,Chevy,lift,lifted,22,24,26,28,30,32,vert,candy,pearl,ect:") }
189
+ its(:contents_as_plain) {should eq("One of the baddest 2 door chevys u will ever see on the road way way to much to list car is in Paint shop now getting painted house of color real candy red all the way through the car everything on car is brand new from the motor (no other one like it) and to the lift (done by underground rim king) fiberglass digital dash this is a one of a kind only car I have ever seen with a see through hood on it car has everything I want 20,000 cash or close to it but.... I will trade for either one of the following: a tahoe, or pick up,hummer h2,silver ado, Sierra,Dually, range rover,porsche suv,avalanche,magnum,charger,cls 500,745,range rover,infinity of any kind im open just send me a text or email either one is good or a vert!!! I will drive to u or meet u half way o yea and the rims are 30's floaters (786)257-7215 Cj text me\nDonk,floaters,trade,Chevy,lift,lifted,22,24,26,28,30,32,vert,candy,pearl,ect:") }
190
+
191
+ end
192
+
193
+ context "posting_hil_cto_012012.html" do
194
+ # This example was picked since we were failing to parse the post_date:
195
+ subject{ described_class.new uri_for('posting_hil_cto_012012.html') }
196
+
197
+ its(:post_date) {should eq(Date.parse('2013-01-20'))}
198
+ its(:full_section) {should eq([ 'tampa bay', 'hillsborough co',
199
+ 'all for sale / wanted', 'cars & trucks - by owner' ])}
200
+
201
+ its(:header) {should eq("2002 Jaguar X-Type 90,000 miles - $4900 (Tampa/Brandon)")}
202
+ its(:label) {should eq("2002 Jaguar X-Type 90,000 miles - $4900")}
203
+ its(:title) {should eq("2002 Jaguar X-Type 90,000 miles - $4900 (Tampa/Brandon)")}
204
+
205
+ its(:location) {should eq('Tampa/Brandon')}
206
+ its(:posting_id) {should eq(3559534414)}
207
+ its(:reply_to) {should eq('xxnxb-3559534414@sale.craigslist.org')}
208
+ its(:post_time) {should eq(DateTime.parse('2013-01-20, 4:24PM EST'))}
209
+ its(:post_date) {should eq(Date.parse('2013-01-20'))}
210
+
211
+ its(:price) {should eq(4900)}
212
+ its(:images) {should eq(["http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00390_zpsc95bcf98.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00392_zps1b90d33c.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00395_zps0047f176.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00398-1_zps4b01580d.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00401-1_zps69e67678.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00404_zps1dfd3717.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00406_zps370a3ffa.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00411_zps8584b52e.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00412_zpsbf6b145b.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00415_zps0341d9d2.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00421_zpsa71182c6.jpg", "http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00417_zpsf5f23e08.jpg"])}
213
+ its(:pics) {should eq([])}
214
+ its(:img_types) {should eq([:img])}
215
+
216
+ its(:contents) {should eq("2002 Jaguar X-Type, automatick, 90,000 miles, cold ac, grey with black leather, power windows, power seats, power mirrors, power door locks with keyless entry, power sunroof, wood trim and more, looks and runs great. Call 727-439-3027<br><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00390_zpsc95bcf98.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00390_zpsc95bcf98.jpg\" border=\"0\" alt=\" photo DSC00390_zpsc95bcf98.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00392_zps1b90d33c.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00392_zps1b90d33c.jpg\" border=\"0\" alt=\" photo DSC00392_zps1b90d33c.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00395_zps0047f176.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00395_zps0047f176.jpg\" border=\"0\" alt=\" photo DSC00395_zps0047f176.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00398-1_zps4b01580d.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00398-1_zps4b01580d.jpg\" border=\"0\" alt=\" photo DSC00398-1_zps4b01580d.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00401-1_zps69e67678.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00401-1_zps69e67678.jpg\" border=\"0\" alt=\" photo DSC00401-1_zps69e67678.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00404_zps1dfd3717.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00404_zps1dfd3717.jpg\" border=\"0\" alt=\" photo DSC00404_zps1dfd3717.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00406_zps370a3ffa.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00406_zps370a3ffa.jpg\" border=\"0\" alt=\" photo DSC00406_zps370a3ffa.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00411_zps8584b52e.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00411_zps8584b52e.jpg\" border=\"0\" alt=\" photo DSC00411_zps8584b52e.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00412_zpsbf6b145b.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00412_zpsbf6b145b.jpg\" border=\"0\" alt=\" photo DSC00412_zpsbf6b145b.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00415_zps0341d9d2.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00415_zps0341d9d2.jpg\" border=\"0\" alt=\" photo DSC00415_zps0341d9d2.jpg\"></a><br><a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00421_zpsa71182c6.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00421_zpsa71182c6.jpg\" border=\"0\" alt=\" photo DSC00421_zpsa71182c6.jpg\"></a>\n<a href=\"http://s730.beta.photobucket.com/user/brianvangelov/media/DSC00417_zpsf5f23e08.jpg.html\" target=\"_blank\" rel=\"nofollow\"><img src=\"http://i730.photobucket.com/albums/ww303/brianvangelov/DSC00417_zpsf5f23e08.jpg\" border=\"0\" alt=\" photo DSC00417_zpsf5f23e08.jpg\"></a>") }
217
+ its(:contents_as_plain) {should eq("2002 Jaguar X-Type, automatick, 90,000 miles, cold ac, grey with black leather, power windows, power seats, power mirrors, power door locks with keyless entry, power sunroof, wood trim and more, looks and runs great. Call 727-439-3027\n") }
218
+
156
219
  end
157
220
  end
@@ -1,8 +1,8 @@
1
+ require 'timecop'
1
2
  require_relative '../lib/libcraigscrape'
2
- # require_relative '../test/libcraigscrape_test_helpers'
3
- # include LibcraigscrapeTestHelpers
4
3
 
5
4
  def uri_for(filename)
6
5
  'file://%s' % [ File.dirname(File.expand_path(__FILE__)),
7
6
  'assets', filename].join('/')
8
7
  end
8
+
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  require 'test/unit'
4
+ require 'timecop'
5
+
4
6
  require File.dirname(__FILE__)+'/../lib/libcraigscrape'
5
7
  require File.dirname(__FILE__)+'/libcraigscrape_test_helpers'
6
8
 
@@ -202,6 +204,8 @@ class CraigslistListingTest < Test::Unit::TestCase
202
204
  end
203
205
 
204
206
  def test_nasty_search_listings
207
+ Timecop.freeze Time.local(2012,12,31)
208
+
205
209
  miami_search_sss_rack900_061809 = CraigScrape::Listings.new relative_uri_for('listing_samples/miami_search_sss_rack.6.18.09/miami_search_sss_rack900.6.18.09.html')
206
210
  assert_equal '/search/sss?query=rack&s=1000', miami_search_sss_rack900_061809.next_page_href
207
211
 
@@ -210,48 +214,49 @@ class CraigslistListingTest < Test::Unit::TestCase
210
214
 
211
215
  mia_search_kitten031510 = CraigScrape::Listings.new relative_uri_for('listing_samples/mia_search_kitten.3.15.10.html')
212
216
  assert_equal "Adopt a 7 month on kitten- $75", mia_search_kitten031510.posts[0].label
213
- assert_equal Date.parse('03/15'), mia_search_kitten031510.posts[0].post_date
217
+ assert_equal Date.parse('2012/03/15'), mia_search_kitten031510.posts[0].post_date
214
218
  assert_equal "Adorable Kitten! Free!!!", mia_search_kitten031510.posts[1].label
215
- assert_equal Date.parse('03/15'), mia_search_kitten031510.posts[1].post_date
219
+ assert_equal Date.parse('2012/03/15'), mia_search_kitten031510.posts[1].post_date
216
220
  assert_equal "KITTENS,5 months, 1 Russian blue, 1 grey & white,vac spy/neu,$35fee ea", mia_search_kitten031510.posts[2].label
217
- assert_equal Date.parse('3/13'), mia_search_kitten031510.posts[2].post_date
221
+ assert_equal Date.parse('2012/3/13'), mia_search_kitten031510.posts[2].post_date
218
222
  assert_equal "Kitties need a good home", mia_search_kitten031510.posts[3].label
219
- assert_equal Date.parse('3/13'), mia_search_kitten031510.posts[3].post_date
223
+ assert_equal Date.parse('2012/3/13'), mia_search_kitten031510.posts[3].post_date
220
224
  assert_equal "7 week old kittens for adoption", mia_search_kitten031510.posts[4].label
221
- assert_equal Date.parse('3/13'), mia_search_kitten031510.posts[4].post_date
225
+ assert_equal Date.parse('2012/3/13'), mia_search_kitten031510.posts[4].post_date
222
226
  assert_equal "Adorable Orange Kitten Free to Good Home", mia_search_kitten031510.posts[5].label
223
- assert_equal Date.parse('3/12'), mia_search_kitten031510.posts[5].post_date
227
+ assert_equal Date.parse('2012/3/12'), mia_search_kitten031510.posts[5].post_date
224
228
  assert_equal "7 month old kitten free to good home", mia_search_kitten031510.posts[6].label
225
- assert_equal Date.parse('3/12'), mia_search_kitten031510.posts[6].post_date
229
+ assert_equal Date.parse('2012/3/12'), mia_search_kitten031510.posts[6].post_date
226
230
  assert_equal "FEMALE KITTEN FOR GOOD HOME", mia_search_kitten031510.posts[7].label
227
- assert_equal Date.parse('3/9'), mia_search_kitten031510.posts[7].post_date
231
+ assert_equal Date.parse('2012/3/9'), mia_search_kitten031510.posts[7].post_date
228
232
  assert_equal "Kitten", mia_search_kitten031510.posts[8].label
229
- assert_equal Date.parse('3/4'), mia_search_kitten031510.posts[8].post_date
233
+ assert_equal Date.parse('2012/3/4'), mia_search_kitten031510.posts[8].post_date
230
234
  assert_equal "Kitties need a good home", mia_search_kitten031510.posts[9].label
231
- assert_equal Date.parse('3/4'), mia_search_kitten031510.posts[9].post_date
235
+ assert_equal Date.parse('2012/3/4'), mia_search_kitten031510.posts[9].post_date
232
236
  assert_equal "Persain Cat And Tabby Cat", mia_search_kitten031510.posts[10].label
233
- assert_equal Date.parse('3/1'), mia_search_kitten031510.posts[10].post_date
237
+ assert_equal Date.parse('2012/3/1'), mia_search_kitten031510.posts[10].post_date
234
238
  assert_equal "Tabby female kitten in a parking lot needs your help", mia_search_kitten031510.posts[11].label
235
- assert_equal Date.parse('2/23'), mia_search_kitten031510.posts[11].post_date
239
+ assert_equal Date.parse('2012/2/23'), mia_search_kitten031510.posts[11].post_date
236
240
  assert_equal "Spring is almost officially here, grow your family, adopt a kitty!", mia_search_kitten031510.posts[12].label
237
- assert_equal Date.parse('2/22'), mia_search_kitten031510.posts[12].post_date
241
+ assert_equal Date.parse('2012/2/22'), mia_search_kitten031510.posts[12].post_date
238
242
  assert_equal "Many adorable kittens for adoption!", mia_search_kitten031510.posts[13].label
239
- assert_equal Date.parse('2/22'), mia_search_kitten031510.posts[13].post_date
243
+ assert_equal Date.parse('2012/2/22'), mia_search_kitten031510.posts[13].post_date
240
244
  assert_equal "2 free cats/kitten to good home", mia_search_kitten031510.posts[14].label
241
- assert_equal Date.parse('2/19'), mia_search_kitten031510.posts[14].post_date
245
+ assert_equal Date.parse('2012/2/19'), mia_search_kitten031510.posts[14].post_date
242
246
  assert_equal "BEAUTIFUL KITTENS", mia_search_kitten031510.posts[15].label
243
- assert_equal Date.parse('2/19'), mia_search_kitten031510.posts[15].post_date
247
+ assert_equal Date.parse('2012/2/19'), mia_search_kitten031510.posts[15].post_date
244
248
  assert_equal "MANY new adorable kittens for good homes!!!", mia_search_kitten031510.posts[16].label
245
- assert_equal Date.parse('2/18'), mia_search_kitten031510.posts[16].post_date
249
+ assert_equal Date.parse('2012/2/18'), mia_search_kitten031510.posts[16].post_date
246
250
  assert_equal "Kitten living in a parking lot needs your help", mia_search_kitten031510.posts[17].label
247
- assert_equal Date.parse('2/16'), mia_search_kitten031510.posts[17].post_date
251
+ assert_equal Date.parse('2012/2/16'), mia_search_kitten031510.posts[17].post_date
248
252
  assert_equal "BEAUTIFUL 8 WEEK KITTENS", mia_search_kitten031510.posts[18].label
249
- assert_equal Date.parse('2/16'), mia_search_kitten031510.posts[18].post_date
253
+ assert_equal Date.parse('2012/2/16'), mia_search_kitten031510.posts[18].post_date
250
254
  assert_equal "ORANGE TABBY KITTEN", mia_search_kitten031510.posts[19].label
251
- assert_equal Date.parse('2/13'), mia_search_kitten031510.posts[19].post_date
255
+ assert_equal Date.parse('2012/2/13'), mia_search_kitten031510.posts[19].post_date
252
256
  assert_equal "Lots of kittens to choose from! Pics!!", mia_search_kitten031510.posts[20].label
253
- assert_equal Date.parse('2/13'), mia_search_kitten031510.posts[20].post_date
257
+ assert_equal Date.parse('2012/2/13'), mia_search_kitten031510.posts[20].post_date
254
258
 
259
+ Timecop.return
255
260
  end
256
261
 
257
262
  def test_new_listing_span051710_labels
metadata CHANGED
@@ -1,306 +1,314 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: libcraigscrape
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 1
8
- - 0
9
- version: 1.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Chris DeRose
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-12-15 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: htmlentities
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
25
19
  - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 4
29
- - 3
30
- version: "4.3"
20
+ - !ruby/object:Gem::Version
21
+ version: '4.3'
31
22
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: nokogiri
35
23
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 1
42
- - 4
43
- - 4
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '4.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: nokogiri
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
44
37
  version: 1.4.4
45
38
  type: :runtime
46
- version_requirements: *id002
47
- - !ruby/object:Gem::Dependency
48
- name: activerecord
49
39
  prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
51
- requirements:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: activerecord
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
52
51
  - - ~>
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 3
56
- - 2
57
- - 9
52
+ - !ruby/object:Gem::Version
58
53
  version: 3.2.9
59
54
  type: :runtime
60
- version_requirements: *id003
61
- - !ruby/object:Gem::Dependency
62
- name: activesupport
63
55
  prerelease: false
64
- requirement: &id004 !ruby/object:Gem::Requirement
65
- requirements:
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
66
59
  - - ~>
67
- - !ruby/object:Gem::Version
68
- segments:
69
- - 3
70
- - 2
71
- - 9
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.9
62
+ - !ruby/object:Gem::Dependency
63
+ name: activesupport
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
72
69
  version: 3.2.9
73
70
  type: :runtime
74
- version_requirements: *id004
75
- - !ruby/object:Gem::Dependency
76
- name: rspec
77
71
  prerelease: false
78
- requirement: &id005 !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- segments:
83
- - 0
84
- version: "0"
85
- type: :runtime
86
- version_requirements: *id005
87
- - !ruby/object:Gem::Dependency
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 3.2.9
78
+ - !ruby/object:Gem::Dependency
88
79
  name: money
89
- prerelease: false
90
- requirement: &id006 !ruby/object:Gem::Requirement
91
- requirements:
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
92
83
  - - ~>
93
- - !ruby/object:Gem::Version
94
- segments:
95
- - 5
96
- - 0
97
- - 0
84
+ - !ruby/object:Gem::Version
98
85
  version: 5.0.0
99
86
  type: :runtime
100
- version_requirements: *id006
101
- - !ruby/object:Gem::Dependency
102
- name: kwalify
103
87
  prerelease: false
104
- requirement: &id007 !ruby/object:Gem::Requirement
105
- requirements:
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
106
91
  - - ~>
107
- - !ruby/object:Gem::Version
108
- segments:
109
- - 0
110
- - 7
111
- version: "0.7"
92
+ - !ruby/object:Gem::Version
93
+ version: 5.0.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: kwalify
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '0.7'
112
102
  type: :runtime
113
- version_requirements: *id007
114
- - !ruby/object:Gem::Dependency
115
- name: actionmailer
116
103
  prerelease: false
117
- requirement: &id008 !ruby/object:Gem::Requirement
118
- requirements:
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
119
107
  - - ~>
120
- - !ruby/object:Gem::Version
121
- segments:
122
- - 3
123
- - 2
124
- - 9
108
+ - !ruby/object:Gem::Version
109
+ version: '0.7'
110
+ - !ruby/object:Gem::Dependency
111
+ name: actionmailer
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
125
117
  version: 3.2.9
126
118
  type: :runtime
127
- version_requirements: *id008
128
- - !ruby/object:Gem::Dependency
129
- name: sqlite3
130
119
  prerelease: false
131
- requirement: &id009 !ruby/object:Gem::Requirement
132
- requirements:
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
133
123
  - - ~>
134
- - !ruby/object:Gem::Version
135
- segments:
136
- - 1
137
- - 3
138
- version: "1.3"
124
+ - !ruby/object:Gem::Version
125
+ version: 3.2.9
126
+ - !ruby/object:Gem::Dependency
127
+ name: sqlite3
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: '1.3'
139
134
  type: :runtime
140
- version_requirements: *id009
141
- - !ruby/object:Gem::Dependency
142
- name: typhoeus
143
135
  prerelease: false
144
- requirement: &id010 !ruby/object:Gem::Requirement
145
- requirements:
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.3'
142
+ - !ruby/object:Gem::Dependency
143
+ name: typhoeus
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
146
147
  - - ~>
147
- - !ruby/object:Gem::Version
148
- segments:
149
- - 0
150
- - 5
151
- version: "0.5"
148
+ - !ruby/object:Gem::Version
149
+ version: '0.5'
152
150
  type: :runtime
153
- version_requirements: *id010
154
- - !ruby/object:Gem::Dependency
155
- name: rake
156
151
  prerelease: false
157
- requirement: &id011 !ruby/object:Gem::Requirement
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- segments:
162
- - 0
163
- version: "0"
164
- type: :runtime
165
- version_requirements: *id011
166
- - !ruby/object:Gem::Dependency
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: '0.5'
158
+ - !ruby/object:Gem::Dependency
167
159
  name: rspec
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: 2.12.0
166
+ type: :development
168
167
  prerelease: false
169
- requirement: &id012 !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- segments:
174
- - 2
175
- - 12
176
- - 0
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
177
173
  version: 2.12.0
174
+ - !ruby/object:Gem::Dependency
175
+ name: timecop
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: 0.5.9
178
182
  type: :development
179
- version_requirements: *id012
180
- description: "An easy library to do the heavy lifting between you and Craigslist\xE2\x80\x98s posting database. Given a URL, libcraigscrape will follow links, scrape fields, and make ruby-sense out of the raw html from craigslist\xE2\x80\x98s servers. libcraigscrape was primarily developed to support the included craigwatch script. See the included craigwatch script for examples of libcraigscape in action, and (hopefully) to serve an immediate craigscraping need."
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: 0.5.9
190
+ description: An easy library to do the heavy lifting between you and Craigslist‘s
191
+ posting database. Given a URL, libcraigscrape will follow links, scrape fields,
192
+ and make ruby-sense out of the raw html from craigslist‘s servers. libcraigscrape
193
+ was primarily developed to support the included craigwatch script. See the included
194
+ craigwatch script for examples of libcraigscape in action, and (hopefully) to serve
195
+ an immediate craigscraping need.
181
196
  email: info@derosetechnologies.com
182
197
  executables: []
183
-
184
198
  extensions: []
185
-
186
199
  extra_rdoc_files: []
187
-
188
- files:
200
+ files:
189
201
  - Rakefile
190
202
  - bin/craig_report_schema.yml
191
- - bin/craigwatch
192
- - bin/report_mailer/report.html.erb
193
203
  - bin/report_mailer/report.text.erb
194
- - lib/geo_listings.rb
195
- - lib/libcraigscrape.rb
204
+ - bin/report_mailer/report.html.erb
205
+ - bin/craigwatch
196
206
  - lib/listings.rb
207
+ - lib/geo_listings.rb
197
208
  - lib/posting.rb
209
+ - lib/libcraigscrape.rb
198
210
  - lib/scraper.rb
199
- - test/geolisting_samples/geo_listing_ca070209.html
200
- - test/geolisting_samples/geo_listing_ca_sk070209.html
201
- - test/geolisting_samples/geo_listing_cn070209.html
202
- - test/geolisting_samples/geo_listing_us070209.html
203
- - test/geolisting_samples/hierarchy_test071009/index.html
204
- - test/geolisting_samples/hierarchy_test071009/us/fl/ft%20myers%20%5C/%20SW%20florida/index.html
205
- - test/geolisting_samples/hierarchy_test071009/us/fl/ft%20myers%20%5C/index.html
206
- - test/geolisting_samples/hierarchy_test071009/us/fl/index.html
207
- - test/geolisting_samples/hierarchy_test071009/us/fl/miami/index.html
208
- - test/geolisting_samples/hierarchy_test071009/us/fl/miami/nonsense/index.html
209
- - test/geolisting_samples/hierarchy_test071009/us/fl/miami/nonsense/more-nonsense/index.html
210
- - test/geolisting_samples/hierarchy_test071009/us/fl/nonexist/index.html
211
- - test/geolisting_samples/hierarchy_test071009/us/fl/nonsense/index.html
212
- - test/geolisting_samples/hierarchy_test071009/us/fl/south%20florida/index.html
213
- - test/geolisting_samples/hierarchy_test071009/us/index.html
214
- - test/google.html
215
211
  - test/libcraigscrape_test_helpers.rb
212
+ - test/test_craigslist_posting.rb
216
213
  - test/listing_samples/category_output.html
217
- - test/listing_samples/category_output_2.html
214
+ - test/listing_samples/short_search_output.html
218
215
  - test/listing_samples/empty_listings.html
219
- - test/listing_samples/fortmyers_art_index.060909/1046596324.html
220
- - test/listing_samples/fortmyers_art_index.060909/1053085283.html
221
- - test/listing_samples/fortmyers_art_index.060909/1112522674.html
222
- - test/listing_samples/fortmyers_art_index.060909/823516079.html
223
- - test/listing_samples/fortmyers_art_index.060909/825684735.html
216
+ - test/listing_samples/mia_fua_index8900.5.21.09.html
217
+ - test/listing_samples/mia_search_kitten.3.15.10.html
224
218
  - test/listing_samples/fortmyers_art_index.060909/891513957.html
219
+ - test/listing_samples/fortmyers_art_index.060909/1053085283.html
225
220
  - test/listing_samples/fortmyers_art_index.060909/897549505.html
226
- - test/listing_samples/fortmyers_art_index.060909/960826026.html
227
- - test/listing_samples/fortmyers_art_index.060909/993256300.html
221
+ - test/listing_samples/fortmyers_art_index.060909/825684735.html
228
222
  - test/listing_samples/fortmyers_art_index.060909/fortmyers_art_index500.060909.html
229
223
  - test/listing_samples/fortmyers_art_index.060909/fortmyers_art_index600.060909.html
224
+ - test/listing_samples/fortmyers_art_index.060909/960826026.html
225
+ - test/listing_samples/fortmyers_art_index.060909/1046596324.html
226
+ - test/listing_samples/fortmyers_art_index.060909/993256300.html
227
+ - test/listing_samples/fortmyers_art_index.060909/1112522674.html
228
+ - test/listing_samples/fortmyers_art_index.060909/823516079.html
229
+ - test/listing_samples/category_output_2.html
230
230
  - test/listing_samples/long_search_output.html
231
- - test/listing_samples/mia_fua_index8900.5.21.09.html
232
- - test/listing_samples/mia_search_kitten.3.15.10.html
233
- - test/listing_samples/miami_search_sss_rack.6.18.09/miami_search_sss_rack1000.6.18.09.html
234
231
  - test/listing_samples/miami_search_sss_rack.6.18.09/miami_search_sss_rack900.6.18.09.html
232
+ - test/listing_samples/miami_search_sss_rack.6.18.09/miami_search_sss_rack1000.6.18.09.html
235
233
  - test/listing_samples/new_listing_span.4.17.10.html
236
- - test/listing_samples/short_search_output.html
237
- - test/post_samples/1207457727.html
234
+ - test/test_craigslist_listing.rb
235
+ - test/post_samples/posting4.html
238
236
  - test/post_samples/brw_reb_1224008903.html
239
- - test/post_samples/posting0.html
240
237
  - test/post_samples/posting1.html
241
- - test/post_samples/posting1796890756-061710.html
242
- - test/post_samples/posting1808219423.html
238
+ - test/post_samples/posting0.html
243
239
  - test/post_samples/posting1938291834-090610.html
244
- - test/post_samples/posting2.html
245
- - test/post_samples/posting3.html
246
- - test/post_samples/posting4.html
247
240
  - test/post_samples/posting5.html
241
+ - test/post_samples/posting1796890756-061710.html
242
+ - test/post_samples/posting3.html
243
+ - test/post_samples/this_post_has_expired.html
244
+ - test/post_samples/posting1808219423.html
248
245
  - test/post_samples/sfbay_art_1223614914.html
249
246
  - test/post_samples/this_post_has_been_deleted_by_its_author.html
250
- - test/post_samples/this_post_has_expired.html
247
+ - test/post_samples/1207457727.html
248
+ - test/post_samples/posting2.html
249
+ - test/google.html
251
250
  - test/test_craigslist_geolisting.rb
252
- - test/test_craigslist_listing.rb
253
- - test/test_craigslist_posting.rb
254
- - spec/assets/geolisting_iso_us_120412.html
251
+ - test/geolisting_samples/geo_listing_ca_sk070209.html
252
+ - test/geolisting_samples/geo_listing_ca070209.html
253
+ - test/geolisting_samples/geo_listing_cn070209.html
254
+ - test/geolisting_samples/hierarchy_test071009/us/fl/miami/nonsense/more-nonsense/index.html
255
+ - test/geolisting_samples/hierarchy_test071009/us/fl/miami/nonsense/index.html
256
+ - test/geolisting_samples/hierarchy_test071009/us/fl/miami/index.html
257
+ - test/geolisting_samples/hierarchy_test071009/us/fl/nonsense/index.html
258
+ - test/geolisting_samples/hierarchy_test071009/us/fl/south%20florida/index.html
259
+ - test/geolisting_samples/hierarchy_test071009/us/fl/nonexist/index.html
260
+ - test/geolisting_samples/hierarchy_test071009/us/fl/ft%20myers%20%5C/%20SW%20florida/index.html
261
+ - test/geolisting_samples/hierarchy_test071009/us/fl/ft%20myers%20%5C/index.html
262
+ - test/geolisting_samples/hierarchy_test071009/us/fl/index.html
263
+ - test/geolisting_samples/hierarchy_test071009/us/index.html
264
+ - test/geolisting_samples/hierarchy_test071009/index.html
265
+ - test/geolisting_samples/geo_listing_us070209.html
266
+ - spec/assets/posting_hil_cto_011913.html
267
+ - spec/assets/posting_mdc_cto_ftl_112612.html
268
+ - spec/assets/posting_sya_121012-2.html
255
269
  - spec/assets/listing_cta_ftl_112612.html
256
- - spec/assets/listing_rea_miami_123012.html
270
+ - spec/assets/geolisting_iso_us_120412.html
257
271
  - spec/assets/listing_search_ppa_nyc_121212.html
272
+ - spec/assets/posting_sya_121012.html
273
+ - spec/assets/listing_rea_miami_123012.html
258
274
  - spec/assets/posting_daytona_art_120512-2.html
259
275
  - spec/assets/posting_daytona_art_120512.html
260
- - spec/assets/posting_mdc_cto_ftl_112612.html
261
- - spec/assets/posting_mdc_reb_120612.html
276
+ - spec/assets/posting_hil_cto_012012.html
262
277
  - spec/assets/posting_sfbay_1226.html
263
- - spec/assets/posting_sya_121012-2.html
264
- - spec/assets/posting_sya_121012.html
278
+ - spec/assets/posting_mdc_reb_120612.html
265
279
  - spec/assets/this_post_has_expired_old.html
266
- - spec/geolisting_spec.rb
267
- - spec/listings_spec.rb
268
280
  - spec/postings_spec.rb
269
281
  - spec/spec_helper.rb
282
+ - spec/listings_spec.rb
283
+ - spec/geolisting_spec.rb
270
284
  - Gemfile
271
285
  - CHANGELOG
272
286
  - COPYING
273
287
  - COPYING.LESSER
274
288
  - README
275
- has_rdoc: true
276
289
  homepage: http://www.derosetechnologies.com/community/libcraigscrape
277
290
  licenses: []
278
-
279
291
  post_install_message:
280
292
  rdoc_options: []
281
-
282
- require_paths:
293
+ require_paths:
283
294
  - lib
284
- required_ruby_version: !ruby/object:Gem::Requirement
285
- requirements:
286
- - - ">="
287
- - !ruby/object:Gem::Version
288
- segments:
289
- - 0
290
- version: "0"
291
- required_rubygems_version: !ruby/object:Gem::Requirement
292
- requirements:
293
- - - ">="
294
- - !ruby/object:Gem::Version
295
- segments:
296
- - 0
297
- version: "0"
295
+ required_ruby_version: !ruby/object:Gem::Requirement
296
+ none: false
297
+ requirements:
298
+ - - ! '>='
299
+ - !ruby/object:Gem::Version
300
+ version: '0'
301
+ required_rubygems_version: !ruby/object:Gem::Requirement
302
+ none: false
303
+ requirements:
304
+ - - ! '>='
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
298
307
  requirements: []
299
-
300
308
  rubyforge_project:
301
- rubygems_version: 1.3.6
309
+ rubygems_version: 1.8.24
302
310
  signing_key:
303
311
  specification_version: 3
304
- summary: quick, easy, craigslist parsing library that takes the monotony out of working with craigslist posts and listings
312
+ summary: quick, easy, craigslist parsing library that takes the monotony out of working
313
+ with craigslist posts and listings
305
314
  test_files: []
306
-