spark_api 1.4.29 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  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/models.rb +2 -0
  9. data/lib/spark_api/models/floplan.rb +24 -0
  10. data/lib/spark_api/models/listing.rb +11 -1
  11. data/lib/spark_api/models/media.rb +30 -0
  12. data/lib/spark_api/models/subresource.rb +2 -2
  13. data/lib/spark_api/models/video.rb +108 -0
  14. data/lib/spark_api/models/virtual_tour.rb +16 -0
  15. data/lib/spark_api/request.rb +2 -2
  16. data/script/reso_middleware_example.rb +70 -0
  17. data/spec/fixtures/listings/floplans_index.json +15 -0
  18. data/spec/spec_helper.rb +9 -4
  19. data/spec/unit/spark_api/authentication/api_auth_spec.rb +21 -22
  20. data/spec/unit/spark_api/authentication/base_auth_spec.rb +3 -3
  21. data/spec/unit/spark_api/authentication/oauth2_impl/faraday_middleware_spec.rb +1 -1
  22. data/spec/unit/spark_api/authentication/oauth2_impl/grant_type_base_spec.rb +1 -1
  23. data/spec/unit/spark_api/authentication/oauth2_impl/single_session_provider_spec.rb +2 -2
  24. data/spec/unit/spark_api/authentication/oauth2_spec.rb +40 -40
  25. data/spec/unit/spark_api/authentication_spec.rb +2 -2
  26. data/spec/unit/spark_api/configuration/yaml_spec.rb +44 -44
  27. data/spec/unit/spark_api/configuration_spec.rb +56 -57
  28. data/spec/unit/spark_api/faraday_middleware_spec.rb +12 -12
  29. data/spec/unit/spark_api/models/account_spec.rb +20 -20
  30. data/spec/unit/spark_api/models/activity_spec.rb +5 -5
  31. data/spec/unit/spark_api/models/base_spec.rb +32 -32
  32. data/spec/unit/spark_api/models/concerns/destroyable_spec.rb +2 -2
  33. data/spec/unit/spark_api/models/concerns/savable_spec.rb +19 -19
  34. data/spec/unit/spark_api/models/connect_prefs_spec.rb +1 -1
  35. data/spec/unit/spark_api/models/constraint_spec.rb +1 -1
  36. data/spec/unit/spark_api/models/contact_spec.rb +50 -50
  37. data/spec/unit/spark_api/models/dirty_spec.rb +12 -12
  38. data/spec/unit/spark_api/models/document_spec.rb +3 -3
  39. data/spec/unit/spark_api/models/fields_spec.rb +17 -17
  40. data/spec/unit/spark_api/models/finders_spec.rb +7 -7
  41. data/spec/unit/spark_api/models/floplan_spec.rb +24 -0
  42. data/spec/unit/spark_api/models/listing_cart_spec.rb +46 -46
  43. data/spec/unit/spark_api/models/listing_meta_translations_spec.rb +6 -6
  44. data/spec/unit/spark_api/models/listing_spec.rb +91 -91
  45. data/spec/unit/spark_api/models/message_spec.rb +10 -10
  46. data/spec/unit/spark_api/models/note_spec.rb +10 -10
  47. data/spec/unit/spark_api/models/notification_spec.rb +6 -6
  48. data/spec/unit/spark_api/models/open_house_spec.rb +4 -4
  49. data/spec/unit/spark_api/models/photo_spec.rb +8 -8
  50. data/spec/unit/spark_api/models/portal_spec.rb +4 -4
  51. data/spec/unit/spark_api/models/property_types_spec.rb +5 -5
  52. data/spec/unit/spark_api/models/rental_calendar_spec.rb +13 -11
  53. data/spec/unit/spark_api/models/rule_spec.rb +2 -2
  54. data/spec/unit/spark_api/models/saved_search_spec.rb +33 -33
  55. data/spec/unit/spark_api/models/search_template/quick_search_spec.rb +5 -5
  56. data/spec/unit/spark_api/models/shared_listing_spec.rb +12 -12
  57. data/spec/unit/spark_api/models/sort_spec.rb +3 -3
  58. data/spec/unit/spark_api/models/standard_fields_spec.rb +12 -12
  59. data/spec/unit/spark_api/models/subresource_spec.rb +33 -15
  60. data/spec/unit/spark_api/models/system_info_spec.rb +7 -7
  61. data/spec/unit/spark_api/models/tour_of_home_spec.rb +3 -3
  62. data/spec/unit/spark_api/models/video_spec.rb +9 -9
  63. data/spec/unit/spark_api/models/virtual_tour_spec.rb +7 -7
  64. data/spec/unit/spark_api/models/vow_account_spec.rb +8 -8
  65. data/spec/unit/spark_api/multi_client_spec.rb +14 -14
  66. data/spec/unit/spark_api/options_hash_spec.rb +4 -4
  67. data/spec/unit/spark_api/paginate_spec.rb +71 -71
  68. data/spec/unit/spark_api/primary_array_spec.rb +5 -5
  69. data/spec/unit/spark_api/request_spec.rb +65 -59
  70. data/spec/unit/spark_api_spec.rb +6 -6
  71. metadata +184 -248
@@ -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
@@ -19,13 +19,13 @@ describe Notification do
19
19
  stub_api_get('/notifications', 'notifications/notifications.json')
20
20
 
21
21
  notifications = Notification.get
22
- notifications.should be_an(Array)
23
- notifications.count.should equal(3)
22
+ expect(notifications).to be_an(Array)
23
+ expect(notifications.count).to equal(3)
24
24
  end
25
25
 
26
26
  on_post_it "should create a new notification" do
27
27
  stub_api_post("/notifications", 'notifications/new.json', 'notifications/post.json')
28
- subject.save.should be(true)
28
+ expect(subject.save).to be(true)
29
29
  end
30
30
 
31
31
  on_post_it "should fail saving" do
@@ -36,8 +36,8 @@ describe Notification do
36
36
  m.attributes['Message'] = 'Your PDF generation has completed!'
37
37
  m.attributes['BrowserUri'] = 'http://myapplication.com/cmas/19581825.pdf'
38
38
  m.attributes['ResourceUri'] = 'http://myapplication.com/cmas/19581825.json'
39
- m.save.should be(false)
40
- expect{ m.save! }.to raise_error(SparkApi::ClientError){ |e| e.status.should == 400 }
39
+ expect(m.save).to be(false)
40
+ expect{ m.save! }.to raise_error(SparkApi::ClientError){ |e| expect(e.status).to eq(400) }
41
41
  end
42
42
  end
43
43
 
@@ -56,7 +56,7 @@ describe Notification do
56
56
  stub_api_get('/notifications/unread', 'notifications/unread.json', {:_pagination => 'count'})
57
57
 
58
58
  notification_count = Notification.unread
59
- notification_count.should equal(30)
59
+ expect(notification_count).to equal(30)
60
60
  end
61
61
  end
62
62
  end
@@ -14,7 +14,7 @@ describe OpenHouse do
14
14
  end
15
15
 
16
16
  it "should respond to a few methods" do
17
- subject.class.should respond_to(:find_by_listing_key)
17
+ expect(subject.class).to respond_to(:find_by_listing_key)
18
18
  end
19
19
 
20
20
  context "/listings/<listing_id>/openhouses", :support do
@@ -22,9 +22,9 @@ describe OpenHouse do
22
22
  stub_auth_request
23
23
  stub_api_get('/listings/20060412165917817933000000/openhouses','listings/open_houses.json')
24
24
  houses = subject.class.find_by_listing_key('20060412165917817933000000')
25
- houses.should be_an(Array)
26
- houses.length.should eq(2)
27
- houses.first.Id.should eq("20101127153422574618000000")
25
+ expect(houses).to be_an(Array)
26
+ expect(houses.length).to eq(2)
27
+ expect(houses.first.Id).to eq("20101127153422574618000000")
28
28
  end
29
29
  end
30
30
 
@@ -20,14 +20,14 @@ describe Photo do
20
20
  end
21
21
 
22
22
  it "responds to" do
23
- subject.should respond_to(:primary?)
24
- Photo.should respond_to(:find_by_listing_key)
23
+ expect(subject).to respond_to(:primary?)
24
+ expect(Photo).to respond_to(:find_by_listing_key)
25
25
  end
26
26
 
27
27
  it "knows if it's the primary photo" do
28
- subject.primary?.should be_true
28
+ expect(subject.primary?).to be true
29
29
  subject.Primary = false
30
- subject.primary?.should be_false
30
+ expect(subject.primary?).to be false
31
31
  end
32
32
  end
33
33
 
@@ -42,7 +42,7 @@ describe Photo do
42
42
  end
43
43
 
44
44
  it "should be scoped to a listing" do
45
- subject.class.path.should eq("/listings/1234/photos")
45
+ expect(subject.class.path).to eq("/listings/1234/photos")
46
46
  end
47
47
 
48
48
  describe "/listings/<listing_id>/photos", :support do
@@ -53,7 +53,7 @@ describe Photo do
53
53
 
54
54
  on_get_it "should get an array of photos" do
55
55
  p = Photo.find_by_listing_key('1234')
56
- p.should be_an(Array)
56
+ expect(p).to be_an(Array)
57
57
  end
58
58
 
59
59
  on_post_it "should upload a new photo" do
@@ -62,7 +62,7 @@ describe Photo do
62
62
  subject.Caption = "Creators of flexMLS!"
63
63
  subject.load_picture("spec/fixtures/logo_fbs.png")
64
64
  subject.save!
65
- subject.Id.should eq("20110826220032167405000000")
65
+ expect(subject.Id).to eq("20110826220032167405000000")
66
66
  end
67
67
  end
68
68
 
@@ -78,7 +78,7 @@ describe Photo do
78
78
  subject.Caption = "Creators of flexMLS!"
79
79
  subject.load_picture("spec/fixtures/logo_fbs.png")
80
80
  subject.save!
81
- subject.Id.should eq("20110826220032167405000000")
81
+ expect(subject.Id).to eq("20110826220032167405000000")
82
82
  end
83
83
 
84
84
  on_put_it "should rotate a photo" do
@@ -11,13 +11,13 @@ describe Portal do
11
11
  it "should return a new portal if the current user doesn't have one yet" do
12
12
  stub_api_get("/portal", "portal/my_non_existant.json")
13
13
  portal = Portal.my
14
- portal.persisted?.should eq(false)
14
+ expect(portal.persisted?).to eq(false)
15
15
  end
16
16
 
17
17
  it "should get the current user's portal" do
18
18
  stub_api_get("/portal", "portal/my.json")
19
19
  portal = Portal.my
20
- portal.persisted?.should eq(true)
20
+ expect(portal.persisted?).to eq(true)
21
21
  end
22
22
 
23
23
  it "should create a portal for the current user" do
@@ -35,7 +35,7 @@ describe Portal do
35
35
  s = stub_api_put("/portal/20100912153422758914000000", "portal/enable.json", "portal/post.json")
36
36
  portal = Portal.my
37
37
  portal.enable
38
- s.should have_been_requested
38
+ expect(s).to have_been_requested
39
39
  end
40
40
 
41
41
  it "should disable the current user's portal" do
@@ -43,7 +43,7 @@ describe Portal do
43
43
  s = stub_api_put("/portal/20100912153422758914000000", "portal/disable.json", "portal/post.json")
44
44
  portal = Portal.my
45
45
  portal.disable
46
- s.should have_been_requested
46
+ expect(s).to have_been_requested
47
47
  end
48
48
 
49
49
  end
@@ -3,7 +3,7 @@ require './spec/spec_helper'
3
3
  describe PropertyTypes do
4
4
 
5
5
  it "should respond to get" do
6
- PropertyTypes.should respond_to(:get)
6
+ expect(PropertyTypes).to respond_to(:get)
7
7
  end
8
8
 
9
9
  describe "/propertytypes", :support do
@@ -15,8 +15,8 @@ describe PropertyTypes do
15
15
  stub_api_get("/propertytypes", "property_types/property_types.json")
16
16
 
17
17
  types = PropertyTypes.get
18
- types.should be_an(Array)
19
- types.count.should be(6)
18
+ expect(types).to be_an(Array)
19
+ expect(types.count).to be(6)
20
20
  end
21
21
  end
22
22
 
@@ -29,8 +29,8 @@ describe PropertyTypes do
29
29
  stub_api_get("/propertytypes/all", "property_types/property_types.json")
30
30
 
31
31
  types = PropertyTypes.all
32
- types.should be_an(Array)
33
- types.count.should be(6)
32
+ expect(types).to be_an(Array)
33
+ expect(types.count).to be(6)
34
34
  end
35
35
  end
36
36
 
@@ -10,21 +10,23 @@ describe RentalCalendar do
10
10
 
11
11
  on_get_it "should get an array of rental calendars" do
12
12
  p = RentalCalendar.find_by_listing_key('1234')
13
- p.should be_an(Array)
14
- p.length.should == 2
13
+ expect(p).to be_an(Array)
14
+ expect(p.length).to eq(2)
15
15
  end
16
16
 
17
17
  end
18
18
 
19
19
  describe "test include_date method" do
20
- cal = RentalCalendar.new
21
- cal.StartDate = Date.parse("2012-07-12")
22
- cal.EndDate = Date.parse("2012-07-18")
23
- cal.include_date?(Date.parse("2012-06-01")).should == false
24
- cal.include_date?(Date.parse("2012-07-12")).should == true
25
- cal.include_date?(Date.parse("2012-07-15")).should == true
26
- cal.include_date?(Date.parse("2012-07-18")).should == true
27
- cal.include_date?(Date.parse("2012-08-01")).should == false
20
+ it "knows about included dates" do
21
+ cal = RentalCalendar.new
22
+ cal.StartDate = Date.parse("2012-07-12")
23
+ cal.EndDate = Date.parse("2012-07-18")
24
+ expect(cal.include_date?(Date.parse("2012-06-01"))).to be false
25
+ expect(cal.include_date?(Date.parse("2012-07-12"))).to be true
26
+ expect(cal.include_date?(Date.parse("2012-07-15"))).to be true
27
+ expect(cal.include_date?(Date.parse("2012-07-18"))).to be true
28
+ expect(cal.include_date?(Date.parse("2012-08-01"))).to be false
29
+ end
28
30
  end
29
31
 
30
- end
32
+ end
@@ -9,8 +9,8 @@ describe Rule do
9
9
  stub_api_get('/listings/rules/propertytypes/A','rules/get.json')
10
10
 
11
11
  rules = Rule.for_property_type('A')
12
- rules.should be_an(Array)
13
- rules.length.should == 2
12
+ expect(rules).to be_an(Array)
13
+ expect(rules.length).to eq(2)
14
14
  end
15
15
 
16
16
  end
@@ -13,19 +13,19 @@ describe SavedSearch do
13
13
  on_get_it "should get all SavedSearches" do
14
14
  stub_api_get("/#{subject.class.element_name}", 'saved_searches/get.json')
15
15
  resources = subject.class.get
16
- resources.should be_an(Array)
17
- resources.length.should eq(2)
18
- resources.first.Id.should eq(id)
16
+ expect(resources).to be_an(Array)
17
+ expect(resources.length).to eq(2)
18
+ expect(resources.first.Id).to eq(id)
19
19
  end
20
20
 
21
21
  on_post_it "should create a saved search" do
22
22
  stub_api_post("/#{subject.class.element_name}", "saved_searches/new.json", "saved_searches/post.json")
23
23
  resource = SavedSearch.new({ :Name => "A new search name here" })
24
- resource.should respond_to(:save)
24
+ expect(resource).to respond_to(:save)
25
25
  resource.save
26
- resource.persisted?.should eq(true)
27
- resource.attributes['Id'].should eq("20100815220615294367000000")
28
- resource.attributes['ResourceUri'].should eq("/v1/savedsearches/20100815220615294367000000")
26
+ expect(resource.persisted?).to eq(true)
27
+ expect(resource.attributes['Id']).to eq("20100815220615294367000000")
28
+ expect(resource.attributes['ResourceUri']).to eq("/v1/savedsearches/20100815220615294367000000")
29
29
  end
30
30
 
31
31
  end
@@ -35,15 +35,15 @@ describe SavedSearch do
35
35
  on_get_it "should get a SavedSearch" do
36
36
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/get.json')
37
37
  resource = subject.class.find(id)
38
- resource.Id.should eq(id)
39
- resource.Name.should eq("Search name here")
38
+ expect(resource.Id).to eq(id)
39
+ expect(resource.Name).to eq("Search name here")
40
40
  end
41
41
 
42
42
  on_put_it "should update a SavedSearch" do
43
43
  stub_api_get("/#{subject.class.element_name}/#{id}", "saved_searches/get.json")
44
44
  stub_api_put("/#{subject.class.element_name}/#{id}", "saved_searches/update.json", "saved_searches/post.json")
45
45
  resource = subject.class.find(id)
46
- resource.should respond_to(:save)
46
+ expect(resource).to respond_to(:save)
47
47
  resource.Name = "A new search name here"
48
48
  resource.save
49
49
  end
@@ -52,7 +52,7 @@ describe SavedSearch do
52
52
  stub_api_get("/#{subject.class.element_name}/#{id}", "saved_searches/get.json")
53
53
  stub_api_delete("/#{subject.class.element_name}/#{id}", "generic_delete.json")
54
54
  resource = subject.class.find(id)
55
- resource.should respond_to(:delete)
55
+ expect(resource).to respond_to(:delete)
56
56
  resource.delete
57
57
  end
58
58
 
@@ -61,8 +61,8 @@ describe SavedSearch do
61
61
  stub_api_put("/#{subject.class.element_name}/#{id}/contacts/20101230223226074306000000", nil, "success.json")
62
62
  resource = subject.class.find(id)
63
63
  resource.attach("20101230223226074306000000")
64
- resource.ContactIds.size.should eq(2)
65
- resource.ContactIds.any? { |c| c == "20101230223226074306000000" }.should eq(true)
64
+ expect(resource.ContactIds.size).to eq(2)
65
+ expect(resource.ContactIds.any? { |c| c == "20101230223226074306000000" }).to eq(true)
66
66
  end
67
67
 
68
68
  it "should detach a contact by id" do
@@ -70,7 +70,7 @@ describe SavedSearch do
70
70
  stub_api_delete("/#{subject.class.element_name}/#{id}/contacts/20100815220615294367000000", "generic_delete.json")
71
71
  resource = subject.class.find(id)
72
72
  resource.detach("20100815220615294367000000")
73
- resource.ContactIds.size.should eq(0)
73
+ expect(resource.ContactIds.size).to eq(0)
74
74
  end
75
75
 
76
76
  it "should attach a contact by Contact object" do
@@ -78,8 +78,8 @@ describe SavedSearch do
78
78
  stub_api_put("/#{subject.class.element_name}/#{id}/contacts/20101230223226074306000000", nil, "success.json")
79
79
  resource = subject.class.find(id)
80
80
  resource.attach(Contact.new({ :Id => "20101230223226074306000000" }))
81
- resource.ContactIds.size.should eq(2)
82
- resource.ContactIds.any? { |c| c == "20101230223226074306000000" }.should eq(true)
81
+ expect(resource.ContactIds.size).to eq(2)
82
+ expect(resource.ContactIds.any? { |c| c == "20101230223226074306000000" }).to eq(true)
83
83
  end
84
84
 
85
85
  it "should detach a contact by Contact object" do
@@ -87,7 +87,7 @@ describe SavedSearch do
87
87
  stub_api_delete("/#{subject.class.element_name}/#{id}/contacts/20100815220615294367000000", "generic_delete.json")
88
88
  resource = subject.class.find(id)
89
89
  resource.detach(Contact.new({:Id => "20100815220615294367000000" }))
90
- resource.ContactIds.size.should eq(0)
90
+ expect(resource.ContactIds.size).to eq(0)
91
91
  end
92
92
 
93
93
  it "should initialize ContactIds as an array if nil" do
@@ -96,7 +96,7 @@ describe SavedSearch do
96
96
  resource = subject.class.find(id)
97
97
  resource.ContactIds = nil
98
98
  resource.detach(Contact.new({:Id => "20100815220615294367000000" }))
99
- resource.ContactIds.size.should eq(0)
99
+ expect(resource.ContactIds.size).to eq(0)
100
100
  end
101
101
 
102
102
  describe "listings" do
@@ -106,8 +106,8 @@ describe SavedSearch do
106
106
  stub_api_get("/listings", 'listings/multiple.json',
107
107
  {:_filter => "SavedSearch Eq '#{id}'"})
108
108
  listings = subject.class.find(id).listings
109
- listings.should be_an(Array)
110
- listings[0].should be_a(Listing)
109
+ expect(listings).to be_an(Array)
110
+ expect(listings[0]).to be_a(Listing)
111
111
  end
112
112
 
113
113
  it "should include the permissive parameter for provided searches" do
@@ -133,9 +133,9 @@ describe SavedSearch do
133
133
  on_get_it "should get provided SavedSearches" do
134
134
  stub_api_get("/provided/#{subject.class.element_name}", 'saved_searches/get.json')
135
135
  resources = subject.class.provided.get
136
- resources.should be_an(Array)
137
- resources.length.should eq(2)
138
- resources.first.Id.should eq(id)
136
+ expect(resources).to be_an(Array)
137
+ expect(resources.length).to eq(2)
138
+ expect(resources.first.Id).to eq(id)
139
139
  end
140
140
  end
141
141
 
@@ -143,7 +143,7 @@ describe SavedSearch do
143
143
  on_get_it "should get tagged SavedSearches" do
144
144
  stub_api_get("/#{subject.class.element_name}/tags/Favorite", 'saved_searches/get.json')
145
145
  resources = subject.class.tagged("Favorite")
146
- resources.should be_an(Array)
146
+ expect(resources).to be_an(Array)
147
147
  end
148
148
  end
149
149
 
@@ -155,24 +155,24 @@ describe SavedSearch do
155
155
 
156
156
  resource = subject.class.find(id)
157
157
  contacts = resource.contacts
158
- contacts.should be_an(Array)
158
+ expect(contacts).to be_an(Array)
159
159
  end
160
160
 
161
161
  it "should return an empty array if model isn't persisted" do
162
162
  resource = SavedSearch.new
163
- resource.contacts.should be_an(Array)
163
+ expect(resource.contacts).to be_an(Array)
164
164
  end
165
165
  end
166
166
 
167
167
  describe "favorite?" do
168
168
  it "should return true if the search has been tagged as a favorite" do
169
169
  search = SavedSearch.new(Tags: ["Favorites"])
170
- search.should be_favorite
170
+ expect(search).to be_favorite
171
171
  end
172
172
 
173
173
  it "should return false if the search has not been tagged as a favorite" do
174
174
  search = SavedSearch.new
175
- search.should_not be_favorite
175
+ expect(search).not_to be_favorite
176
176
  end
177
177
  end
178
178
 
@@ -182,7 +182,7 @@ describe SavedSearch do
182
182
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/with_newsfeed.json',
183
183
  { "_expand" => "NewsFeedSubscriptionSummary" } )
184
184
  resource = subject.class.find(id)
185
- resource.has_active_newsfeed?.should == true
185
+ expect(resource.has_active_newsfeed?).to eq(true)
186
186
  end
187
187
 
188
188
  it "should return false if the search doesn't have a newsfeed" do
@@ -190,7 +190,7 @@ describe SavedSearch do
190
190
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/without_newsfeed.json',
191
191
  { "_expand" => "NewsFeedSubscriptionSummary" } )
192
192
  resource = subject.class.find(id)
193
- resource.has_active_newsfeed?.should == false
193
+ expect(resource.has_active_newsfeed?).to eq(false)
194
194
  end
195
195
  end
196
196
 
@@ -200,7 +200,7 @@ describe SavedSearch do
200
200
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/with_inactive_newsfeed.json',
201
201
  { "_expand" => "NewsFeedSubscriptionSummary" } )
202
202
  resource = subject.class.find(id)
203
- resource.has_inactive_newsfeed?.should == true
203
+ expect(resource.has_inactive_newsfeed?).to eq(true)
204
204
  end
205
205
 
206
206
  it "should return false if the search doesn't have a newsfeed" do
@@ -208,7 +208,7 @@ describe SavedSearch do
208
208
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/without_newsfeed.json',
209
209
  { "_expand" => "NewsFeedSubscriptionSummary, NewsFeeds" } )
210
210
  resource = subject.class.find(id)
211
- resource.has_inactive_newsfeed?.should == false
211
+ expect(resource.has_inactive_newsfeed?).to eq(false)
212
212
  end
213
213
 
214
214
  end
@@ -219,7 +219,7 @@ describe SavedSearch do
219
219
  stub_api_get("/#{subject.class.element_name}/#{id}", 'saved_searches/with_newsfeed.json',
220
220
  { "_expand" => "NewsFeeds" } )
221
221
  resource = subject.class.find(id)
222
- resource.newsfeeds.should be_an(Array)
222
+ expect(resource.newsfeeds).to be_an(Array)
223
223
  end
224
224
  end
225
225