spark_api 1.4.34 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/lib/spark_api/authentication/api_auth.rb +1 -1
  5. data/lib/spark_api/authentication/oauth2.rb +1 -1
  6. data/lib/spark_api/authentication/oauth2_impl/grant_type_base.rb +1 -1
  7. data/lib/spark_api/client.rb +2 -2
  8. data/lib/spark_api/request.rb +1 -1
  9. data/spec/spec_helper.rb +9 -4
  10. data/spec/unit/spark_api/authentication/api_auth_spec.rb +21 -22
  11. data/spec/unit/spark_api/authentication/base_auth_spec.rb +3 -3
  12. data/spec/unit/spark_api/authentication/oauth2_impl/faraday_middleware_spec.rb +1 -1
  13. data/spec/unit/spark_api/authentication/oauth2_impl/grant_type_base_spec.rb +1 -1
  14. data/spec/unit/spark_api/authentication/oauth2_impl/single_session_provider_spec.rb +2 -2
  15. data/spec/unit/spark_api/authentication/oauth2_spec.rb +40 -40
  16. data/spec/unit/spark_api/authentication_spec.rb +2 -2
  17. data/spec/unit/spark_api/configuration/yaml_spec.rb +44 -44
  18. data/spec/unit/spark_api/configuration_spec.rb +56 -57
  19. data/spec/unit/spark_api/faraday_middleware_spec.rb +12 -12
  20. data/spec/unit/spark_api/models/account_spec.rb +20 -20
  21. data/spec/unit/spark_api/models/activity_spec.rb +5 -5
  22. data/spec/unit/spark_api/models/base_spec.rb +32 -32
  23. data/spec/unit/spark_api/models/concerns/destroyable_spec.rb +2 -2
  24. data/spec/unit/spark_api/models/concerns/savable_spec.rb +19 -19
  25. data/spec/unit/spark_api/models/connect_prefs_spec.rb +1 -1
  26. data/spec/unit/spark_api/models/constraint_spec.rb +1 -1
  27. data/spec/unit/spark_api/models/contact_spec.rb +50 -50
  28. data/spec/unit/spark_api/models/dirty_spec.rb +12 -12
  29. data/spec/unit/spark_api/models/document_spec.rb +3 -3
  30. data/spec/unit/spark_api/models/fields_spec.rb +17 -17
  31. data/spec/unit/spark_api/models/finders_spec.rb +7 -7
  32. data/spec/unit/spark_api/models/floplan_spec.rb +4 -4
  33. data/spec/unit/spark_api/models/listing_cart_spec.rb +46 -46
  34. data/spec/unit/spark_api/models/listing_meta_translations_spec.rb +6 -6
  35. data/spec/unit/spark_api/models/listing_spec.rb +91 -91
  36. data/spec/unit/spark_api/models/message_spec.rb +10 -10
  37. data/spec/unit/spark_api/models/note_spec.rb +10 -10
  38. data/spec/unit/spark_api/models/notification_spec.rb +6 -6
  39. data/spec/unit/spark_api/models/open_house_spec.rb +4 -4
  40. data/spec/unit/spark_api/models/photo_spec.rb +8 -8
  41. data/spec/unit/spark_api/models/portal_spec.rb +4 -4
  42. data/spec/unit/spark_api/models/property_types_spec.rb +5 -5
  43. data/spec/unit/spark_api/models/rental_calendar_spec.rb +13 -11
  44. data/spec/unit/spark_api/models/rule_spec.rb +2 -2
  45. data/spec/unit/spark_api/models/saved_search_spec.rb +33 -33
  46. data/spec/unit/spark_api/models/search_template/quick_search_spec.rb +5 -5
  47. data/spec/unit/spark_api/models/shared_listing_spec.rb +12 -12
  48. data/spec/unit/spark_api/models/sort_spec.rb +3 -3
  49. data/spec/unit/spark_api/models/standard_fields_spec.rb +12 -12
  50. data/spec/unit/spark_api/models/subresource_spec.rb +18 -18
  51. data/spec/unit/spark_api/models/system_info_spec.rb +7 -7
  52. data/spec/unit/spark_api/models/tour_of_home_spec.rb +3 -3
  53. data/spec/unit/spark_api/models/video_spec.rb +9 -9
  54. data/spec/unit/spark_api/models/virtual_tour_spec.rb +7 -7
  55. data/spec/unit/spark_api/models/vow_account_spec.rb +8 -8
  56. data/spec/unit/spark_api/multi_client_spec.rb +14 -14
  57. data/spec/unit/spark_api/options_hash_spec.rb +4 -4
  58. data/spec/unit/spark_api/paginate_spec.rb +71 -71
  59. data/spec/unit/spark_api/primary_array_spec.rb +5 -5
  60. data/spec/unit/spark_api/request_spec.rb +60 -60
  61. data/spec/unit/spark_api_spec.rb +6 -6
  62. metadata +162 -233
@@ -74,91 +74,91 @@ describe Listing do
74
74
 
75
75
  describe "attributes" do
76
76
  it "should allow access to fields" do
77
- @listing.StandardFields.should be_a(Hash)
78
- @listing.StandardFields['ListingId'].should be_a(String)
79
- @listing.StandardFields['ListPrice'].should match(@listing.ListPrice)
80
- @listing.photos.should be_a(Array)
77
+ expect(@listing.StandardFields).to be_a(Hash)
78
+ expect(@listing.StandardFields['ListingId']).to be_a(String)
79
+ expect(@listing.StandardFields['ListPrice']).to match(@listing.ListPrice)
80
+ expect(@listing.photos).to be_a(Array)
81
81
  end
82
82
 
83
83
  it "should not respond to removed attributes" do
84
- @listing.should_not respond_to(:Photos)
85
- @listing.should_not respond_to(:Documents)
86
- @listing.should_not respond_to(:VirtualTours)
87
- @listing.should_not respond_to(:Videos)
84
+ expect(@listing).not_to respond_to(:Photos)
85
+ expect(@listing).not_to respond_to(:Documents)
86
+ expect(@listing).not_to respond_to(:VirtualTours)
87
+ expect(@listing).not_to respond_to(:Videos)
88
88
  end
89
89
 
90
90
  describe '.street_address' do
91
91
  it 'should return the street address' do
92
- @listing.street_address.should eq("100 Someone's St")
92
+ expect(@listing.street_address).to eq("100 Someone's St")
93
93
  end
94
94
 
95
95
  it 'should remove data masks' do
96
96
  @listing.StandardFields["UnparsedFirstLineAddress"] = "********"
97
- @listing.street_address.should eq("")
97
+ expect(@listing.street_address).to eq("")
98
98
  end
99
99
 
100
100
  it 'should handle a missing unparsed first line address' do
101
101
  [nil, '', ' '].each do |current|
102
102
  @listing.StandardFields['UnparsedFirstLineAddress'] = current
103
- @listing.street_address.should eq('')
103
+ expect(@listing.street_address).to eq('')
104
104
  end
105
105
  end
106
106
  end
107
107
 
108
108
  it "should return the regional address" do
109
- @listing.region_address.should eq("Fargo, ND 55320")
109
+ expect(@listing.region_address).to eq("Fargo, ND 55320")
110
110
  end
111
111
 
112
112
  it "should return full address" do
113
- @listing.full_address.should eq("100 Someone's St, Fargo, ND 55320")
113
+ expect(@listing.full_address).to eq("100 Someone's St, Fargo, ND 55320")
114
114
  end
115
115
 
116
116
  it "should provide shortcut methods to standard fields" do
117
- @listing.StreetName.should eq("Someone's")
118
- @listing.YearBuilt.should eq(nil)
119
- @listing.BuildingAreaTotal.should eq("1321.0")
120
- @listing.PublicRemarks.should eq(nil)
121
- @listing.PostalCode.should eq("55320")
122
- @listing.ListPrice.should eq("100000.0")
117
+ expect(@listing.StreetName).to eq("Someone's")
118
+ expect(@listing.YearBuilt).to eq(nil)
119
+ expect(@listing.BuildingAreaTotal).to eq("1321.0")
120
+ expect(@listing.PublicRemarks).to eq(nil)
121
+ expect(@listing.PostalCode).to eq("55320")
122
+ expect(@listing.ListPrice).to eq("100000.0")
123
123
  end
124
124
 
125
125
  it "should report that it responds to shortcut methods to standard fields" do
126
- @listing.should respond_to(:StreetName)
127
- @listing.should respond_to(:YearBuilt)
128
- @listing.should respond_to(:BuildingAreaTotal)
129
- @listing.should respond_to(:PublicRemarks)
130
- @listing.should respond_to(:PostalCode)
131
- @listing.should respond_to(:ListPrice)
132
-
133
- @listing.should_not respond_to(:BogusField)
126
+ expect(@listing).to respond_to(:StreetName)
127
+ expect(@listing).to respond_to(:YearBuilt)
128
+ expect(@listing).to respond_to(:BuildingAreaTotal)
129
+ expect(@listing).to respond_to(:PublicRemarks)
130
+ expect(@listing).to respond_to(:PostalCode)
131
+ expect(@listing).to respond_to(:ListPrice)
132
+
133
+ expect(@listing).not_to respond_to(:BogusField)
134
134
  @listing.StandardFields['BogusField'] = 'bogus'
135
- @listing.should respond_to(:BogusField)
135
+ expect(@listing).to respond_to(:BogusField)
136
136
  end
137
137
  end
138
138
 
139
139
  describe "class methods" do
140
140
  it "should respond to find" do
141
- Listing.should respond_to(:find)
141
+ expect(Listing).to respond_to(:find)
142
142
  end
143
143
 
144
144
  it "should respond to first" do
145
- Listing.should respond_to(:first)
145
+ expect(Listing).to respond_to(:first)
146
146
  end
147
147
 
148
148
  it "should respond to last" do
149
- Listing.should respond_to(:last)
149
+ expect(Listing).to respond_to(:last)
150
150
  end
151
151
 
152
152
  it "should respond to my" do
153
- Listing.should respond_to(:my)
153
+ expect(Listing).to respond_to(:my)
154
154
  end
155
155
 
156
156
  it "should respond to find_by_cart_id" do
157
- Listing.should respond_to(:find_by_cart_id)
157
+ expect(Listing).to respond_to(:find_by_cart_id)
158
158
  end
159
159
 
160
160
  it "should respond to count" do
161
- Listing.should respond_to(:count)
161
+ expect(Listing).to respond_to(:count)
162
162
  end
163
163
  end
164
164
 
@@ -172,14 +172,14 @@ describe Listing do
172
172
  stub_api_get('/listings', 'listings/multiple.json', {:_filter => "PostalCode Eq '83805'"})
173
173
 
174
174
  listings = Listing.find(:all, :_filter => "PostalCode Eq '83805'")
175
- listings.should be_an(Array)
176
- listings.count.should eq(2)
175
+ expect(listings).to be_an(Array)
176
+ expect(listings.count).to eq(2)
177
177
  end
178
178
 
179
179
  on_get_it "should return the count" do
180
180
  stub_api_get("/listings", 'count.json', { :_pagination => "count"})
181
181
  count = Listing.count()
182
- count.should == 2001
182
+ expect(count).to eq(2001)
183
183
  end
184
184
  end
185
185
 
@@ -188,10 +188,10 @@ describe Listing do
188
188
  stub_api_get("/listings/20060725224713296297000000", 'listings/no_subresources.json')
189
189
 
190
190
  l = Listing.find('20060725224713296297000000')
191
- l.videos.length.should == 0
192
- l.photos.length.should == 0
193
- l.documents.length.should == 0
194
- l.Id.should eq('20060725224713296297000000')
191
+ expect(l.videos.length).to eq(0)
192
+ expect(l.photos.length).to eq(0)
193
+ expect(l.documents.length).to eq(0)
194
+ expect(l.Id).to eq('20060725224713296297000000')
195
195
  end
196
196
 
197
197
  on_put_it "should save a listing that has modified ListPrice" do
@@ -200,7 +200,7 @@ describe Listing do
200
200
  stub_api_put("/flexmls/listings/#{list_id}", 'listings/put.json', 'success.json')
201
201
  l = Listing.find(list_id)
202
202
  l.ListPrice = 10000.0
203
- l.save.should be(true)
203
+ expect(l.save).to be(true)
204
204
  end
205
205
 
206
206
  on_put_it "should save a listing that has modified ExpirationDate" do
@@ -209,7 +209,7 @@ describe Listing do
209
209
  stub_api_put("/flexmls/listings/#{list_id}", 'listings/put_expiration_date.json', 'success.json')
210
210
  l = Listing.find(list_id)
211
211
  l.ExpirationDate = "2011-10-04"
212
- l.save.should be(true)
212
+ expect(l.save).to be(true)
213
213
  end
214
214
 
215
215
  it "should not save a listing that does not exist", :method => 'PUT' do
@@ -221,8 +221,8 @@ describe Listing do
221
221
  l = Listing.find(list_id)
222
222
  l.Id = "lolwut"
223
223
  l.ListPrice = 10000.0
224
- l.save.should be(false)
225
- expect{ l.save! }.to raise_error(SparkApi::ClientError){ |e| e.status.should == 400 }
224
+ expect(l.save).to be(false)
225
+ expect{ l.save! }.to raise_error(SparkApi::ClientError){ |e| expect(e.status).to eq(400) }
226
226
  end
227
227
 
228
228
  on_put_it "should save a listing with constraints" do
@@ -231,9 +231,9 @@ describe Listing do
231
231
  stub_api_put("/flexmls/listings/#{list_id}", 'listings/put.json', 'listings/constraints.json')
232
232
  l = Listing.find(list_id)
233
233
  l.ListPrice = 10000.0
234
- l.save.should be(true)
235
- l.constraints.size.should eq(1)
236
- l.constraints.first.RuleName.should eq("MaxValue")
234
+ expect(l.save).to be(true)
235
+ expect(l.constraints.size).to eq(1)
236
+ expect(l.constraints.first.RuleName).to eq("MaxValue")
237
237
  end
238
238
 
239
239
  on_put_it "should fail saving a listing with constraints and provide the constraints" do
@@ -245,10 +245,10 @@ describe Listing do
245
245
 
246
246
  l = Listing.find(list_id)
247
247
  l.ListPrice = 10000.0
248
- l.save.should be_false
249
- l.constraints.size.should eq(1)
250
- l.constraints.first.RuleName.should eq("MaxIncreasePercent")
251
- l.errors.size.should eq(1)
248
+ expect(l.save).to be false
249
+ expect(l.constraints.size).to eq(1)
250
+ expect(l.constraints.first.RuleName).to eq("MaxIncreasePercent")
251
+ expect(l.errors.size).to eq(1)
252
252
  end
253
253
 
254
254
  on_put_it "should reorder a photo" do
@@ -257,7 +257,7 @@ describe Listing do
257
257
  stub_api_put("/listings/#{list_id}/photos/20110826220032167405000000", 'listings/put_reorder_photo.json', 'listings/reorder_photo.json')
258
258
  l = Listing.find(list_id)
259
259
  l.reorder_photo("20110826220032167405000000", "2")
260
- l.photos.size.should eq(5)
260
+ expect(l.photos.size).to eq(5)
261
261
  end
262
262
 
263
263
  on_put_it "should raise an exception when an index is not an Integer" do
@@ -277,9 +277,9 @@ describe Listing do
277
277
  stub_api_put("/flexmls/listings/#{list_id}", 'listings/put.json', 'listings/constraints_with_pagination.json', :_pagination => '1')
278
278
  l = Listing.find(list_id)
279
279
  l.ListPrice = 10000.0
280
- l.save(:_pagination => '1').should be(true)
281
- l.constraints.size.should eq(1)
282
- l.constraints.first.RuleName.should eq("MaxValue")
280
+ expect(l.save(:_pagination => '1')).to be(true)
281
+ expect(l.constraints.size).to eq(1)
282
+ expect(l.constraints.first.RuleName).to eq("MaxValue")
283
283
  end
284
284
  end
285
285
 
@@ -288,47 +288,47 @@ describe Listing do
288
288
  stub_api_get("/listings/1234", 'listings/with_photos.json', { :_expand => "Photos" })
289
289
 
290
290
  l = Listing.find('1234', :_expand => "Photos")
291
- l.photos.length.should == 5
292
- l.documents.length.should == 0
293
- l.videos.length.should == 0
294
- l.virtual_tours.length.should == 0
291
+ expect(l.photos.length).to eq(5)
292
+ expect(l.documents.length).to eq(0)
293
+ expect(l.videos.length).to eq(0)
294
+ expect(l.virtual_tours.length).to eq(0)
295
295
  end
296
296
 
297
297
  on_get_it "should return an array of documents" do
298
298
  stub_api_get("/listings/1234", 'listings/with_documents.json', { :_expand => "Documents" })
299
299
 
300
300
  l = Listing.find('1234', :_expand => "Documents")
301
- l.photos.length.should == 0
302
- l.documents.length.should == 2
303
- l.videos.length.should == 0
304
- l.virtual_tours.length.should == 0
301
+ expect(l.photos.length).to eq(0)
302
+ expect(l.documents.length).to eq(2)
303
+ expect(l.videos.length).to eq(0)
304
+ expect(l.virtual_tours.length).to eq(0)
305
305
  end
306
306
 
307
307
  on_get_it "should return an array of virtual tours" do
308
308
  stub_api_get("/listings/1234", 'listings/with_vtour.json', { :_expand => "VirtualTours" })
309
309
 
310
310
  l = Listing.find('1234', :_expand => "VirtualTours")
311
- l.virtual_tours.length.should == 1
312
- l.photos.length.should == 0
313
- l.documents.length.should == 0
314
- l.videos.length.should == 0
311
+ expect(l.virtual_tours.length).to eq(1)
312
+ expect(l.photos.length).to eq(0)
313
+ expect(l.documents.length).to eq(0)
314
+ expect(l.videos.length).to eq(0)
315
315
  end
316
316
 
317
317
  on_get_it "should return an array of videos" do
318
318
  stub_api_get("/listings/1234", 'listings/with_videos.json', { :_expand => "Videos" })
319
319
 
320
320
  l = Listing.find('1234', :_expand => "Videos")
321
- l.videos.length.should == 2
322
- l.virtual_tours.length.should == 0
323
- l.photos.length.should == 0
324
- l.documents.length.should == 0
321
+ expect(l.videos.length).to eq(2)
322
+ expect(l.virtual_tours.length).to eq(0)
323
+ expect(l.photos.length).to eq(0)
324
+ expect(l.documents.length).to eq(0)
325
325
  end
326
326
 
327
327
  on_get_it "should return an array of rental calendars" do
328
328
  stub_api_get("/listings/1234", 'listings/with_rental_calendar.json', { :_expand => "RentalCalendar" })
329
329
 
330
330
  l = Listing.find('1234', :_expand => "RentalCalendar")
331
- l.rental_calendars.length.should == 2
331
+ expect(l.rental_calendars.length).to eq(2)
332
332
  end
333
333
 
334
334
  ## TourOfHomes: Not implemented yet ##
@@ -337,19 +337,19 @@ describe Listing do
337
337
  #stub_api_get("/listings/20060725224713296297000000/tourofhomes", 'listings/tour_of_homes.json')
338
338
 
339
339
  #l = Listing.find('20060725224713296297000000')
340
- #l.tour_of_homes().length.should == 2
341
- #l.videos.length.should == 0
342
- #l.photos.length.should == 0
343
- #l.documents.length.should == 0
340
+ #expect(l.tour_of_homes().length).to eq 2
341
+ #expect(l.videos.length).to eq 0
342
+ #expect(l.photos.length).to eq 0
343
+ #expect(l.documents.length).to eq 0
344
344
  #end
345
345
 
346
346
  on_get_it "should return permissions" do
347
347
  stub_api_get("/listings/20060725224713296297000000", 'listings/with_permissions.json', { :_expand => "Permissions" })
348
348
  l = Listing.find('20060725224713296297000000', :_expand => "Permissions")
349
- l.Permissions["Editable"].should eq(true)
350
- l.editable?().should eq(true)
351
- l.editable?(:PriceChange).should eq(true)
352
- l.editable?(:Photos).should eq(false)
349
+ expect(l.Permissions["Editable"]).to eq(true)
350
+ expect(l.editable?()).to eq(true)
351
+ expect(l.editable?(:PriceChange)).to eq(true)
352
+ expect(l.editable?(:Photos)).to eq(false)
353
353
  end
354
354
 
355
355
  on_delete_it "should bulk delete listing photos" do
@@ -359,7 +359,7 @@ describe Listing do
359
359
  photo_id1 = l.photos[0].Id
360
360
  photo_id2 = l.photos[1].Id
361
361
  stub_api_delete("/listings/#{list_id}/photos/#{photo_id1},#{photo_id2}", 'listings/photos/index.json')
362
- l.delete_photos(photo_id1 + "," + photo_id2).should_not be_empty
362
+ expect(l.delete_photos(photo_id1 + "," + photo_id2)).not_to be_empty
363
363
  end
364
364
  end
365
365
  end
@@ -369,8 +369,8 @@ describe Listing do
369
369
  stub_api_get('/my/listings', 'listings/multiple.json')
370
370
 
371
371
  listings = Listing.my
372
- listings.should be_an(Array)
373
- listings.count.should eq(2)
372
+ expect(listings).to be_an(Array)
373
+ expect(listings.count).to eq(2)
374
374
  end
375
375
  end
376
376
 
@@ -379,8 +379,8 @@ describe Listing do
379
379
  stub_api_get('/office/listings', 'listings/multiple.json')
380
380
 
381
381
  listings = Listing.office
382
- listings.should be_an(Array)
383
- listings.count.should eq(2)
382
+ expect(listings).to be_an(Array)
383
+ expect(listings.count).to eq(2)
384
384
  end
385
385
  end
386
386
 
@@ -389,8 +389,8 @@ describe Listing do
389
389
  stub_api_get('/company/listings', 'listings/multiple.json')
390
390
 
391
391
  listings = Listing.company
392
- listings.should be_an(Array)
393
- listings.count.should eq(2)
392
+ expect(listings).to be_an(Array)
393
+ expect(listings.count).to eq(2)
394
394
  end
395
395
  end
396
396
 
@@ -399,7 +399,7 @@ describe Listing do
399
399
  stub_api_get("/listings/nearby",
400
400
  'listings/no_subresources.json', {:_lat => "45.45", :_lon => "-93.98"})
401
401
  l = Listing.nearby(45.45, -93.98)
402
- l.length.should == 1
402
+ expect(l.length).to eq(1)
403
403
  end
404
404
  end
405
405
 
@@ -409,8 +409,8 @@ describe Listing do
409
409
 
410
410
  listings = Listing.tour_of_homes
411
411
 
412
- listings.should be_an(Array)
413
- listings.count.should eq(2)
412
+ expect(listings).to be_an(Array)
413
+ expect(listings.count).to eq(2)
414
414
 
415
415
  end
416
416
  end
@@ -21,18 +21,18 @@ describe Message do
21
21
  on_get_it "should get all my messages" do
22
22
  stub_api_get("/messages", 'messages/get.json')
23
23
  messages = Message.find(:all)
24
- messages.size.should == 2
24
+ expect(messages.size).to eq(2)
25
25
  end
26
26
 
27
27
  on_post_it "should save a new message" do
28
28
  stub_api_post("/messages", 'messages/new.json', 'messages/post.json')
29
- subject.save.should be(true)
29
+ expect(subject.save).to be(true)
30
30
  end
31
31
 
32
32
  on_post_it "should save a new message with recipients" do
33
33
  stub_api_post("/messages", 'messages/new_with_recipients.json', 'messages/post.json')
34
34
  subject.attributes["Recipients"] = ["20110112234857732941000000","20110092234857738467000000"]
35
- subject.save.should be(true)
35
+ expect(subject.save).to be(true)
36
36
  end
37
37
 
38
38
  on_post_it "should fail saving" do
@@ -40,8 +40,8 @@ describe Message do
40
40
  request.to_return(:status => 400, :body => fixture('errors/failure.json'))
41
41
  end
42
42
  m=subject.class.new
43
- m.save.should be(false)
44
- expect{ m.save! }.to raise_error(SparkApi::ClientError){ |e| e.status.should == 400 }
43
+ expect(m.save).to be(false)
44
+ expect{ m.save! }.to raise_error(SparkApi::ClientError){ |e| expect(e.status).to eq(400) }
45
45
  end
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ describe Message do
49
49
  on_get_it "should get a single message" do
50
50
  subject.attributes["Id"] = "20110353423434130982000000"
51
51
  stub_api_get("/messages/#{subject.Id}", "messages/get.json")
52
- subject.should be_a(Message)
52
+ expect(subject).to be_a(Message)
53
53
  end
54
54
  end
55
55
 
@@ -57,7 +57,7 @@ describe Message do
57
57
  on_get_it "should get all the replies" do
58
58
  subject.attributes["Id"] = "20110353423434130982000000"
59
59
  stub_api_get("/messages/#{subject.Id}/replies", "messages/get.json", :_expand => 'Body, Sender')
60
- subject.replies.size.should == 2
60
+ expect(subject.replies.size).to eq(2)
61
61
  end
62
62
 
63
63
  end
@@ -67,13 +67,13 @@ describe Message do
67
67
  on_get_it "gets unread messages" do
68
68
  stub_api_get("/messages/unread", 'messages/get.json', {})
69
69
  messages = Message.unread
70
- messages.size.should == 2
71
- messages.first.should be_a Message
70
+ expect(messages.size).to eq(2)
71
+ expect(messages.first).to be_a Message
72
72
  end
73
73
 
74
74
  on_get_it "gets unread messages count" do
75
75
  stub_api_get("/messages/unread", 'messages/count.json', _pagination: 'count')
76
- Message.unread_count.should == 78
76
+ expect(Message.unread_count).to eq(78)
77
77
  end
78
78
 
79
79
  end
@@ -3,10 +3,10 @@ require './spec/spec_helper'
3
3
  describe Note do
4
4
 
5
5
  it "responds to instance and class methods" do
6
- Note.should respond_to(:get)
7
- Note.new.should respond_to(:save)
8
- Note.new.should respond_to(:save!)
9
- Note.new.should respond_to(:delete)
6
+ expect(Note).to respond_to(:get)
7
+ expect(Note.new).to respond_to(:save)
8
+ expect(Note.new).to respond_to(:save!)
9
+ expect(Note.new).to respond_to(:delete)
10
10
  end
11
11
 
12
12
  context "when shared with a contact" do
@@ -16,19 +16,19 @@ describe Note do
16
16
  end
17
17
 
18
18
  it "should have the correct path" do
19
- @note.path.should == "/listings/1234/shared/notes/contacts/5678"
19
+ expect(@note.path).to eq("/listings/1234/shared/notes/contacts/5678")
20
20
  end
21
21
 
22
22
  context "/listings/<listing_id>/shared/notes/contacts/<contact_id>", :support do
23
23
  on_get_it "GET should get my notes" do
24
24
  stub_api_get("#{@note.path}", 'notes/agent_shared.json')
25
25
  ret = @note.get
26
- ret.Note.should == "lorem ipsum dolor sit amet"
26
+ expect(ret.Note).to eq("lorem ipsum dolor sit amet")
27
27
  end
28
28
 
29
29
  on_get_it "should return a nil when no shared notes exist" do
30
30
  stub_api_get("#{@note.path}", 'notes/agent_shared_empty.json')
31
- @note.get.should be_nil
31
+ expect(@note.get).to be_nil
32
32
  end
33
33
 
34
34
  on_delete_it "should allow you to delete an existing note" do
@@ -43,15 +43,15 @@ describe Note do
43
43
  request.to_return(:status => 500, :body => fixture('generic_failure.json'))
44
44
  end
45
45
 
46
- expect { n.save! }.to raise_error(SparkApi::ClientError) { |e| e.status.should == 500 }
47
- expect { n.save }.to raise_error(SparkApi::ClientError) { |e| e.status.should == 500 }
46
+ expect { n.save! }.to raise_error(SparkApi::ClientError) { |e| expect(e.status).to eq(500) }
47
+ expect { n.save }.to raise_error(SparkApi::ClientError) { |e| expect(e.status).to eq(500) }
48
48
  end
49
49
 
50
50
  on_put_it "should allow adding of a note" do
51
51
  n = @note.new(:Note => "lorem ipsum dolor")
52
52
  stub_api_put("#{@note.path}", 'notes/new.json', 'notes/add.json')
53
53
  n.save
54
- n.ResourceUri.should == '/v1/listings/20100909200152674436000000/shared/notes/contacts/20110407212043616271000000/'
54
+ expect(n.ResourceUri).to eq('/v1/listings/20100909200152674436000000/shared/notes/contacts/20110407212043616271000000/')
55
55
  end
56
56
 
57
57
  end