spark_api 1.4.28 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +5 -13
  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 +1 -0
  9. data/lib/spark_api/models/account.rb +7 -1
  10. data/lib/spark_api/models/account_report.rb +0 -5
  11. data/lib/spark_api/models/floplan.rb +24 -0
  12. data/lib/spark_api/models/listing.rb +11 -1
  13. data/lib/spark_api/models/subresource.rb +2 -2
  14. data/lib/spark_api/request.rb +2 -2
  15. data/script/reso_middleware_example.rb +70 -0
  16. data/spec/fixtures/listings/floplans_index.json +15 -0
  17. data/spec/spec_helper.rb +9 -4
  18. data/spec/unit/spark_api/authentication/api_auth_spec.rb +21 -22
  19. data/spec/unit/spark_api/authentication/base_auth_spec.rb +3 -3
  20. data/spec/unit/spark_api/authentication/oauth2_impl/faraday_middleware_spec.rb +1 -1
  21. data/spec/unit/spark_api/authentication/oauth2_impl/grant_type_base_spec.rb +1 -1
  22. data/spec/unit/spark_api/authentication/oauth2_impl/single_session_provider_spec.rb +2 -2
  23. data/spec/unit/spark_api/authentication/oauth2_spec.rb +40 -40
  24. data/spec/unit/spark_api/authentication_spec.rb +2 -2
  25. data/spec/unit/spark_api/configuration/yaml_spec.rb +44 -44
  26. data/spec/unit/spark_api/configuration_spec.rb +56 -57
  27. data/spec/unit/spark_api/faraday_middleware_spec.rb +12 -12
  28. data/spec/unit/spark_api/models/account_report_spec.rb +2 -22
  29. data/spec/unit/spark_api/models/account_spec.rb +24 -21
  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 +215 -280
@@ -64,13 +64,13 @@ describe SparkApi do
64
64
  end
65
65
 
66
66
  it "should raised exception when token is expired" do
67
- expect { @connection.get('/expired')}.to raise_error(SparkApi::PermissionDenied){ |e| e.code.should == SparkApi::ResponseCodes::SESSION_TOKEN_EXPIRED }
67
+ expect { @connection.get('/expired')}.to raise_error(SparkApi::PermissionDenied){ |e| expect(e.code).to eq(SparkApi::ResponseCodes::SESSION_TOKEN_EXPIRED) }
68
68
  end
69
69
 
70
70
  it "should raised exception on error" do
71
- expect { @connection.get('/methodnotallowed')}.to raise_error(SparkApi::NotAllowed){ |e| e.message.should == "Method Not Allowed" }
72
- expect { @connection.get('/epicfail')}.to raise_error(SparkApi::ClientError){ |e| e.status.should be(500) }
73
- expect { @connection.get('/unknownerror')}.to raise_error(SparkApi::ClientError){ |e| e.status.should be(499) }
71
+ expect { @connection.get('/methodnotallowed')}.to raise_error(SparkApi::NotAllowed){ |e| expect(e.message).to eq("Method Not Allowed") }
72
+ expect { @connection.get('/epicfail')}.to raise_error(SparkApi::ClientError){ |e| expect(e.status).to be(500) }
73
+ expect { @connection.get('/unknownerror')}.to raise_error(SparkApi::ClientError){ |e| expect(e.status).to be(499) }
74
74
  end
75
75
 
76
76
  it "should raised exception on invalid responses" do
@@ -81,20 +81,20 @@ describe SparkApi do
81
81
 
82
82
  it "should give me a session response" do
83
83
  response = @connection.post('/session').body
84
- response.success.should eq(true)
84
+ expect(response.success).to eq(true)
85
85
  session = SparkApi::Authentication::Session.new(response.results[0])
86
- session.auth_token.should eq("xxxxx")
86
+ expect(session.auth_token).to eq("xxxxx")
87
87
  end
88
88
 
89
89
  it "should give me an api response" do
90
90
  response = @connection.get('/system').body
91
- response.success.should eq(true)
92
- response.results.length.should be > 0
91
+ expect(response.success).to eq(true)
92
+ expect(response.results.length).to be > 0
93
93
  end
94
94
 
95
95
  it "should include the errors in the response" do
96
96
  expect { @connection.get('/badresourcerequest')}.to raise_error(SparkApi::BadResourceRequest){ |e|
97
- e.errors.should == "Some errors and stuff."
97
+ expect(e.errors).to eq("Some errors and stuff.")
98
98
  }
99
99
  end
100
100
 
@@ -111,7 +111,7 @@ describe SparkApi do
111
111
  :response_headers => {}
112
112
  }
113
113
 
114
- middleware.decompress_body(env).should eq("UNCOMPRESSED")
114
+ expect(middleware.decompress_body(env)).to eq("UNCOMPRESSED")
115
115
  end
116
116
 
117
117
  it "should unzip gzipped data" do
@@ -129,7 +129,7 @@ describe SparkApi do
129
129
  }
130
130
  }
131
131
 
132
- middleware.decompress_body(env).should eq(bod)
132
+ expect(middleware.decompress_body(env)).to eq(bod)
133
133
  end
134
134
 
135
135
  it "should inflate deflated data" do
@@ -143,7 +143,7 @@ describe SparkApi do
143
143
  }
144
144
  }
145
145
 
146
- middleware.decompress_body(env).should eq(bod)
146
+ expect(middleware.decompress_body(env)).to eq(bod)
147
147
  end
148
148
  end
149
149
 
@@ -2,6 +2,8 @@ require './spec/spec_helper'
2
2
 
3
3
  describe AccountReport do
4
4
 
5
+ it_behaves_like(:account, AccountReport)
6
+
5
7
  let(:account_report) {
6
8
  AccountReport.new({
7
9
  "Id" => "12345",
@@ -51,27 +53,5 @@ describe AccountReport do
51
53
  end
52
54
 
53
55
  end
54
-
55
- describe 'logo' do
56
-
57
- it 'returns the logo' do
58
- logo = SparkApi::Models::Base.new( {"Type" => "Logo"} )
59
- not_logo = SparkApi::Models::Base.new( {"Type" => "Nope" } )
60
- account_report.images = [logo, not_logo]
61
- expect(account_report.logo).to be logo
62
- end
63
-
64
- it 'returns nil if there is no logo' do
65
- not_logo = SparkApi::Models::Base.new( {"Type" => "Nope" } )
66
- account_report.images = [not_logo]
67
- expect(account_report.logo).to be nil
68
- end
69
-
70
- it 'returns nil if there are no images' do
71
- expect(account_report.images).to be nil
72
- expect(account_report.logo).to be nil
73
- end
74
-
75
- end
76
56
 
77
57
  end
@@ -1,6 +1,9 @@
1
1
  require './spec/spec_helper'
2
2
 
3
3
  describe Account do
4
+
5
+ it_behaves_like(:account, Account)
6
+
4
7
  describe "units" do
5
8
  before(:each) do
6
9
  @account = Account.new({
@@ -98,20 +101,20 @@ describe Account do
98
101
 
99
102
  it "should respond to attributes" do
100
103
  ['Name','Id','Mls','MlsId','Office'].each do |k|
101
- (@account.send k.to_sym).should be_a(String)
104
+ expect(@account.send k.to_sym).to be_a(String)
102
105
  end
103
106
  end
104
107
 
105
108
  it "should have primary subresources" do
106
- @account.emails.primary.Address.should eq("work@test.com")
107
- @account.phones.primary.Number.should eq("701-555-1212")
108
- @account.addresses.primary.Address.should eq("101 Main Ave, Phoenix, AZ 12345")
109
- @account.websites.primary.Uri.should eq("http://iamthebestagent.com")
109
+ expect(@account.emails.primary.Address).to eq("work@test.com")
110
+ expect(@account.phones.primary.Number).to eq("701-555-1212")
111
+ expect(@account.addresses.primary.Address).to eq("101 Main Ave, Phoenix, AZ 12345")
112
+ expect(@account.websites.primary.Uri).to eq("http://iamthebestagent.com")
110
113
  end
111
114
 
112
115
  it "should be able to provide a primary image" do
113
- @account.primary_img("Photo").Name.should == 'My Photo 1'
114
- @account.primary_img("Logo").Name.should == '1 My Logo'
116
+ expect(@account.primary_img("Photo").Name).to eq('My Photo 1')
117
+ expect(@account.primary_img("Logo").Name).to eq('1 My Logo')
115
118
  end
116
119
 
117
120
  after(:each) do
@@ -128,19 +131,19 @@ describe Account do
128
131
  on_get_it "should get my account" do
129
132
  stub_api_get("/my/account", 'accounts/my.json')
130
133
  account = Account.my
131
- account.Id.should eq("20000426173054342350000000")
132
- account.websites.first.Name.should == 'My Work Website'
134
+ expect(account.Id).to eq("20000426173054342350000000")
135
+ expect(account.websites.first.Name).to eq('My Work Website')
133
136
  end
134
137
 
135
138
  on_put_it "should save my portal account" do
136
139
  stub_api_get("/my/account", 'accounts/my_portal.json')
137
140
  stub_api_put("/my/account", 'accounts/my_save.json', 'accounts/my_put.json')
138
141
  account = Account.my
139
- account.Id.should eq("20110426173054342350000000")
140
- account.GetEmailUpdates.should eq(false)
142
+ expect(account.Id).to eq("20110426173054342350000000")
143
+ expect(account.GetEmailUpdates).to eq(false)
141
144
  account.GetEmailUpdates = true
142
145
  account.save!
143
- account.GetEmailUpdates.should eq(true)
146
+ expect(account.GetEmailUpdates).to eq(true)
144
147
  end
145
148
  end
146
149
 
@@ -148,10 +151,10 @@ describe Account do
148
151
  on_get_it "should get all accounts" do
149
152
  stub_api_get("/accounts", 'accounts/all.json')
150
153
  accounts = Account.get
151
- accounts.should be_an(Array)
152
- accounts.length.should eq(3)
153
- accounts.first.Id.should eq("20000426173054342350000000")
154
- accounts.last.Id.should eq("20110126173054382350000000")
154
+ expect(accounts).to be_an(Array)
155
+ expect(accounts.length).to eq(3)
156
+ expect(accounts.first.Id).to eq("20000426173054342350000000")
157
+ expect(accounts.last.Id).to eq("20110126173054382350000000")
155
158
  end
156
159
  on_put_it "should save password" do
157
160
  stub_api_get("/my/account", 'accounts/my.json')
@@ -159,7 +162,7 @@ describe Account do
159
162
  stub_api_put("/accounts/#{account.Id}", 'accounts/password_save.json', 'accounts/my.json')
160
163
  account.Password = "1"
161
164
  account.PasswordValidation = "1"
162
- account.save.should be(true)
165
+ expect(account.save).to be(true)
163
166
  end
164
167
  end
165
168
 
@@ -167,15 +170,15 @@ describe Account do
167
170
  on_get_it "should all office accounts" do
168
171
  stub_api_get("/accounts/by/office/20030426173014239760000000", 'accounts/office.json')
169
172
  accounts = Account.by_office("20030426173014239760000000")
170
- accounts.should be_an(Array)
171
- accounts.length.should eq(2)
173
+ expect(accounts).to be_an(Array)
174
+ expect(accounts.length).to eq(2)
172
175
  accounts.each do |account|
173
- accounts.first.OfficeId.should eq("20030426173014239760000000")
176
+ expect(accounts.first.OfficeId).to eq("20030426173014239760000000")
174
177
  end
175
178
  end
176
179
  end
177
180
 
178
181
  end
179
-
182
+
180
183
  end
181
184
 
@@ -10,9 +10,9 @@ describe Activity do
10
10
  it "gets a current user's activities" do
11
11
  s = stub_api_get("/activities", "activities/get.json")
12
12
  activities = Activity.get
13
- activities.should be_an(Array)
14
- activities.size.should eq(2)
15
- s.should have_been_requested
13
+ expect(activities).to be_an(Array)
14
+ expect(activities.size).to eq(2)
15
+ expect(s).to have_been_requested
16
16
  end
17
17
  end
18
18
 
@@ -21,8 +21,8 @@ describe Activity do
21
21
  it "gets an individual activity" do
22
22
  s = stub_api_get("/activities/#{id}", "activities/get.json")
23
23
  activity = Activity.find(id)
24
- activity.should be_an(Activity)
25
- s.should have_been_requested
24
+ expect(activity).to be_an(Activity)
25
+ expect(s).to have_been_requested
26
26
  end
27
27
  end
28
28
 
@@ -22,31 +22,31 @@ describe MyExampleModel, "Example model" do
22
22
  end
23
23
 
24
24
  it "should be persisted" do
25
- @model.persisted?.should eq(true)
25
+ expect(@model.persisted?).to eq(true)
26
26
  end
27
27
 
28
28
  it "should not be persisted" do
29
29
  @new_model = MyExampleModel.new()
30
- @new_model.persisted?.should eq(false)
30
+ expect(@new_model.persisted?).to eq(false)
31
31
  end
32
32
 
33
33
  it "should parse and return ResourceUri without v1" do
34
- @model.resource_uri.should eq("/some/place/20101230223226074201000000")
34
+ expect(@model.resource_uri).to eq("/some/place/20101230223226074201000000")
35
35
  end
36
36
 
37
37
  it "should parse and return the correct path for a persisted resource" do
38
- @model.path.should eq("/some/place")
38
+ expect(@model.path).to eq("/some/place")
39
39
  end
40
40
 
41
41
  it "should parse and return the correct path" do
42
42
  @model = MyExampleModel.new
43
- @model.path.should eq("/test/example")
43
+ expect(@model.path).to eq("/test/example")
44
44
  end
45
45
 
46
46
  it "should parse and return the correct path for resource with a parent" do
47
47
  @model = MyExampleModel.new
48
48
  @model.parent = Contact.new({ :Id => "20101230223226074201000000" })
49
- @model.path.should eq("/contacts/20101230223226074201000000/test/example")
49
+ expect(@model.path).to eq("/contacts/20101230223226074201000000/test/example")
50
50
  end
51
51
 
52
52
  end
@@ -55,16 +55,16 @@ describe Base, "Base model" do
55
55
 
56
56
  describe "class methods" do
57
57
  it "should set the element name" do
58
- MyExampleModel.element_name.should eq("example")
59
- MyDefaultModel.element_name.should eq("resource")
58
+ expect(MyExampleModel.element_name).to eq("example")
59
+ expect(MyDefaultModel.element_name).to eq("resource")
60
60
  end
61
61
  it "should set the prefix" do
62
- MyExampleModel.prefix.should eq("/test/")
63
- MyDefaultModel.prefix.should eq("/")
62
+ expect(MyExampleModel.prefix).to eq("/test/")
63
+ expect(MyDefaultModel.prefix).to eq("/")
64
64
  end
65
65
  it "should set the path" do
66
- MyExampleModel.path.should eq("/test/example")
67
- MyDefaultModel.path.should eq("/resource")
66
+ expect(MyExampleModel.path).to eq("/test/example")
67
+ expect(MyDefaultModel.path).to eq("/resource")
68
68
  end
69
69
  describe "finders" do
70
70
  before(:each) do
@@ -72,11 +72,11 @@ describe Base, "Base model" do
72
72
  stub_api_get("/test/example", 'base.json')
73
73
  end
74
74
  it "should get all results" do
75
- MyExampleModel.get.length.should == 2
75
+ expect(MyExampleModel.get.length).to eq(2)
76
76
  end
77
77
  it "should get first result" do
78
- MyExampleModel.first.Id.should == 1
79
- MyExampleModel.first.Id.should eq(MyExampleModel.first.id)
78
+ expect(MyExampleModel.first.Id).to eq(1)
79
+ expect(MyExampleModel.first.Id).to eq(MyExampleModel.first.id)
80
80
  end
81
81
  end
82
82
  end
@@ -89,71 +89,71 @@ describe Base, "Base model" do
89
89
  end
90
90
 
91
91
  it "should access existing attributes" do
92
- @model.Name.should == 'My Example'
92
+ expect(@model.Name).to eq('My Example')
93
93
  end
94
94
 
95
95
  it "should raise errors on access to non-existant attributes" do
96
- lambda { @model.Nonsense }.should raise_error(NoMethodError)
96
+ expect { @model.Nonsense }.to raise_error(NoMethodError)
97
97
  end
98
98
 
99
99
  it "should set existing attributes" do
100
100
  new_name = 'John Jacob Jingleheimerschmidt'
101
101
  @model.Name = new_name
102
- @model.Name.should == new_name
102
+ expect(@model.Name).to eq(new_name)
103
103
  end
104
104
 
105
105
  it "should set non-existant attributes" do
106
106
  nonsense = 'nonsense'
107
107
  @model.Nonsense = nonsense
108
- @model.Nonsense.should == nonsense
108
+ expect(@model.Nonsense).to eq(nonsense)
109
109
  end
110
110
 
111
111
  it "should return a boolean for a predicate for an existing attribute" do
112
- @model.Name?.should satisfy { |p| [true, false].include?(p) }
112
+ expect(@model.Name?).to satisfy { |p| [true, false].include?(p) }
113
113
  end
114
114
 
115
115
  it "should return a boolean for whether or not a model is persisted through the api" do
116
- @model.persisted?.should satisfy { |p| [true, false].include?(p) }
116
+ expect(@model.persisted?).to satisfy { |p| [true, false].include?(p) }
117
117
  end
118
118
 
119
119
  it "should raise an Error for a predicate for a non-existant attribute" do
120
- lambda { @model.Nonsense? }.should raise_error(NoMethodError)
120
+ expect { @model.Nonsense? }.to raise_error(NoMethodError)
121
121
  end
122
122
 
123
123
  it "should repond_to existing attributes" do
124
- @model.should respond_to(:Name)
124
+ expect(@model).to respond_to(:Name)
125
125
  end
126
126
 
127
127
  it "should not respond_to non-existant attributes" do
128
- @model.should_not respond_to(:Nonsense)
128
+ expect(@model).not_to respond_to(:Nonsense)
129
129
  end
130
130
 
131
131
  it "should respond_to a setter for an existing attribute" do
132
- @model.should respond_to(:Name=)
132
+ expect(@model).to respond_to(:Name=)
133
133
  end
134
134
 
135
135
  it "should respond_to a setter for a non-existant attribute" do
136
- @model.should respond_to(:Nonsense=)
136
+ expect(@model).to respond_to(:Nonsense=)
137
137
  end
138
138
 
139
139
  it "should respond_to a predicate for an existing attribute" do
140
- @model.should respond_to(:Name?)
140
+ expect(@model).to respond_to(:Name?)
141
141
  end
142
142
 
143
143
  it "should not respond_to a predicate for a non-existant attribute" do
144
- @model.should_not respond_to(:Nonsense?)
144
+ expect(@model).not_to respond_to(:Nonsense?)
145
145
  end
146
146
 
147
147
  it "should respond_to methods inherited from parent classes" do
148
- @model.should respond_to(:freeze)
148
+ expect(@model).to respond_to(:freeze)
149
149
  end
150
150
 
151
151
  it "should respond_to a will_change! method for an existing attribute" do
152
- @model.should respond_to(:Name_will_change!)
152
+ expect(@model).to respond_to(:Name_will_change!)
153
153
  end
154
154
 
155
155
  it "should not respond_to a will_change! method for a non-existant attribute" do
156
- @model.should_not respond_to(:Nonsense_will_change!)
156
+ expect(@model).not_to respond_to(:Nonsense_will_change!)
157
157
  end
158
158
 
159
159
  end
@@ -161,7 +161,7 @@ describe Base, "Base model" do
161
161
  describe "to_partial_path" do
162
162
  it "should return the partial path" do
163
163
  model = MyExampleModel.new()
164
- model.to_partial_path.should eq("my_example_models/my_example_model")
164
+ expect(model.to_partial_path).to eq("my_example_models/my_example_model")
165
165
  end
166
166
  end
167
167
 
@@ -17,7 +17,7 @@ describe Concerns::Destroyable, "Destroyable Concern" do
17
17
  describe 'destroyed?' do
18
18
 
19
19
  it "should not be destroyed" do
20
- @model.destroyed?.should eq(false)
20
+ expect(@model.destroyed?).to eq(false)
21
21
  end
22
22
  end
23
23
 
@@ -27,7 +27,7 @@ describe Concerns::Destroyable, "Destroyable Concern" do
27
27
  stub_api_delete("/some/place/20101230223226074201000000")
28
28
  @model = MyExampleModel.first
29
29
  @model.destroy
30
- @model.destroyed?.should eq(true)
30
+ expect(@model.destroyed?).to eq(true)
31
31
  end
32
32
 
33
33
  end
@@ -31,9 +31,9 @@ describe Concerns::Savable, "Model" do
31
31
  it "should be creatable" do
32
32
  @model = MyExampleModel.new({ :Name => "my name" })
33
33
  s = stub_api_post("/test/example", { :MyExampleModels => [ @model.attributes ] }, "base.json")
34
- @model.save.should eq(true)
35
- @model.persisted?.should eq(true)
36
- s.should have_been_requested
34
+ expect(@model.save).to eq(true)
35
+ expect(@model.persisted?).to eq(true)
36
+ expect(s).to have_been_requested
37
37
  end
38
38
 
39
39
  it "should be updatable" do
@@ -41,37 +41,37 @@ describe Concerns::Savable, "Model" do
41
41
  @model = MyExampleModel.first
42
42
  @model.Name = "new name"
43
43
  s = stub_api_put("/some/place/20101230223226074201000000", @model.dirty_attributes)
44
- @model.save.should eq(true)
45
- @model.persisted?.should eq(true)
46
- s.should have_been_requested
44
+ expect(@model.save).to eq(true)
45
+ expect(@model.persisted?).to eq(true)
46
+ expect(s).to have_been_requested
47
47
  end
48
48
 
49
49
  it "should allow the pluralize method to be overriden" do
50
50
  @model = MyOtherExampleModel.new({ :Name => "my name" })
51
51
  s = stub_api_post("/test/example", { :MyOtherExampleModelThatIsPluralized => [ @model.attributes ] }, "base.json")
52
- @model.save.should eq(true)
53
- @model.persisted?.should eq(true)
54
- s.should have_been_requested
52
+ expect(@model.save).to eq(true)
53
+ expect(@model.persisted?).to eq(true)
54
+ expect(s).to have_been_requested
55
55
  end
56
56
 
57
57
  it "should not pluralize the resource if it already is" do
58
58
  @model = MyPluralizedModels.new({ :Name => "my name" })
59
59
  s = stub_api_post("/test/example", { :MyPluralizedModels => [ @model.attributes ] }, "base.json")
60
- @model.save.should eq(true)
61
- @model.persisted?.should eq(true)
62
- s.should have_been_requested
60
+ expect(@model.save).to eq(true)
61
+ expect(@model.persisted?).to eq(true)
62
+ expect(s).to have_been_requested
63
63
  end
64
64
 
65
65
  it "merges any attributes that come back in the response" do
66
66
  @model = MyExampleModel.new({ :Name => "my name" })
67
67
  s = stub_api_post("/test/example", { :MyExampleModels => [ @model.attributes ] }, "base.json")
68
- @model.save.should eq(true)
69
- @model.persisted?.should eq(true)
70
- @model.Id.should eq(1)
71
- @model.ResourceUri.should eq("/v1/some/place/20101230223226074201000000")
72
- @model.Name.should eq("My Example")
73
- @model.Test.should eq(true)
74
- s.should have_been_requested
68
+ expect(@model.save).to eq(true)
69
+ expect(@model.persisted?).to eq(true)
70
+ expect(@model.Id).to eq(1)
71
+ expect(@model.ResourceUri).to eq("/v1/some/place/20101230223226074201000000")
72
+ expect(@model.Name).to eq("My Example")
73
+ expect(@model.Test).to eq(true)
74
+ expect(s).to have_been_requested
75
75
  end
76
76
 
77
77
  describe "update_attributes" do