mrkt 1.2.0 → 1.2.1

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.
@@ -1,5 +1,5 @@
1
1
  describe Mrkt::CrudCustomObjects do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#get_list_of_custom_activity_types' do
5
5
  let(:response_stub) do
@@ -49,14 +49,14 @@ describe Mrkt::CrudCustomObjects do
49
49
  }
50
50
  end
51
51
 
52
- context 'all activities' do
52
+ context 'with all activities' do
53
+ subject { client.get_list_of_custom_activity_types }
54
+
53
55
  before do
54
56
  stub_request(:get, "https://#{host}/rest/v1/activities/types.json")
55
57
  .to_return(json_stub(response_stub))
56
58
  end
57
59
 
58
- subject { client.get_list_of_custom_activity_types }
59
-
60
60
  it { is_expected.to eq(response_stub) }
61
61
  end
62
62
  end
@@ -104,6 +104,8 @@ describe Mrkt::CrudCustomObjects do
104
104
  end
105
105
 
106
106
  context 'with no additional attributes' do
107
+ subject { client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, date: date) }
108
+
107
109
  let(:request_body) do
108
110
  {
109
111
  input: [{
@@ -122,12 +124,14 @@ describe Mrkt::CrudCustomObjects do
122
124
  .to_return(json_stub(response_stub))
123
125
  end
124
126
 
125
- subject { client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, date: date) }
126
-
127
127
  it { is_expected.to eq(response_stub) }
128
128
  end
129
129
 
130
130
  context 'with additional attributes' do
131
+ subject do
132
+ client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, attributes: attributes, date: date)
133
+ end
134
+
131
135
  let(:request_body) do
132
136
  {
133
137
  input: [{
@@ -148,13 +152,6 @@ describe Mrkt::CrudCustomObjects do
148
152
  }]
149
153
  }
150
154
  end
151
-
152
- before do
153
- stub_request(:post, "https://#{host}/rest/v1/activities/external.json")
154
- .with(json_stub(request_body))
155
- .to_return(json_stub(response_stub))
156
- end
157
-
158
155
  let(:attributes) do
159
156
  {
160
157
  percent: '0.20',
@@ -162,8 +159,10 @@ describe Mrkt::CrudCustomObjects do
162
159
  }
163
160
  end
164
161
 
165
- subject do
166
- client.create_custom_activity(lead_id, activity_type_id, primary_attribute_value, attributes: attributes, date: date)
162
+ before do
163
+ stub_request(:post, "https://#{host}/rest/v1/activities/external.json")
164
+ .with(json_stub(request_body))
165
+ .to_return(json_stub(response_stub))
167
166
  end
168
167
 
169
168
  it { is_expected.to eq(response_stub) }
@@ -1,5 +1,5 @@
1
1
  describe Mrkt::CrudCustomObjects do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#get_list_of_custom_objects' do
5
5
  let(:response_stub) do
@@ -44,17 +44,19 @@ describe Mrkt::CrudCustomObjects do
44
44
  end
45
45
 
46
46
  context 'with no object names' do
47
+ subject { client.get_list_of_custom_objects }
48
+
47
49
  before do
48
50
  stub_request(:get, "https://#{host}/rest/v1/customobjects.json")
49
51
  .to_return(json_stub(response_stub))
50
52
  end
51
53
 
52
- subject { client.get_list_of_custom_objects }
53
-
54
54
  it { is_expected.to eq(response_stub) }
55
55
  end
56
56
 
57
57
  context 'with object names' do
58
+ subject { client.get_list_of_custom_objects(object_names) }
59
+
58
60
  let(:object_names) { %w[device_c manufacturer_c] }
59
61
 
60
62
  before do
@@ -63,13 +65,13 @@ describe Mrkt::CrudCustomObjects do
63
65
  .to_return(json_stub(response_stub))
64
66
  end
65
67
 
66
- subject { client.get_list_of_custom_objects(object_names) }
67
-
68
68
  it { is_expected.to eq(response_stub) }
69
69
  end
70
70
  end
71
71
 
72
72
  describe '#describe_custom_object' do
73
+ subject(:action) { client.describe_custom_object(object_name) }
74
+
73
75
  let(:response_stub) do
74
76
  {
75
77
  requestId: 'eeef#152858b17d2',
@@ -129,8 +131,6 @@ describe Mrkt::CrudCustomObjects do
129
131
  .to_return(json_stub(response_stub))
130
132
  end
131
133
 
132
- subject { client.describe_custom_object(object_name) }
133
-
134
134
  context 'when the object name is valid' do
135
135
  let(:object_name) { :device_c }
136
136
 
@@ -140,13 +140,15 @@ describe Mrkt::CrudCustomObjects do
140
140
  context 'when the object name is invalid' do
141
141
  let(:object_name) { nil }
142
142
 
143
- it 'should raise an Error' do
144
- expect { subject }.to raise_error(Mrkt::Errors::Unknown)
143
+ it 'raises an Error' do
144
+ expect { action }.to raise_error(Mrkt::Errors::Unknown)
145
145
  end
146
146
  end
147
147
  end
148
148
 
149
149
  describe '#createupdate_custom_objects' do
150
+ subject { client.createupdate_custom_objects(object_name, devices) }
151
+
150
152
  let(:object_name) { 'device' }
151
153
 
152
154
  let(:devices) do
@@ -178,8 +180,6 @@ describe Mrkt::CrudCustomObjects do
178
180
  }
179
181
  end
180
182
 
181
- subject { client.createupdate_custom_objects(object_name, devices) }
182
-
183
183
  before do
184
184
  stub_request(:post, "https://#{host}/rest/v1/customobjects/#{object_name}.json")
185
185
  .with(json_stub(request_body))
@@ -190,6 +190,8 @@ describe Mrkt::CrudCustomObjects do
190
190
  end
191
191
 
192
192
  describe '#delete_custom_objects' do
193
+ subject { client.delete_custom_objects(object_name, search_fields) }
194
+
193
195
  let(:object_name) { 'device' }
194
196
 
195
197
  let(:search_fields) do
@@ -215,8 +217,6 @@ describe Mrkt::CrudCustomObjects do
215
217
  }
216
218
  end
217
219
 
218
- subject { client.delete_custom_objects(object_name, search_fields) }
219
-
220
220
  before do
221
221
  stub_request(:post, "https://#{host}/rest/v1/customobjects/#{object_name}/delete.json")
222
222
  .with(json_stub(request_body))
@@ -227,6 +227,8 @@ describe Mrkt::CrudCustomObjects do
227
227
  end
228
228
 
229
229
  describe '#get_custom_objects' do
230
+ subject { client.get_custom_objects(object_name, filter_values) }
231
+
230
232
  let(:object_name) { 'device' }
231
233
 
232
234
  let(:filter_values) do
@@ -256,8 +258,6 @@ describe Mrkt::CrudCustomObjects do
256
258
  }
257
259
  end
258
260
 
259
- subject { client.get_custom_objects(object_name, filter_values) }
260
-
261
261
  before do
262
262
  stub_request(:post, "https://#{host}/rest/v1/customobjects/#{object_name}.json?_method=GET")
263
263
  .with(json_stub(request_body))
@@ -1,5 +1,5 @@
1
1
  describe Mrkt::CrudLeads do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe 'get_lead_by_id' do
5
5
  subject { client.get_lead_by_id(id, fields: fields) }
@@ -56,6 +56,8 @@ describe Mrkt::CrudLeads do
56
56
  end
57
57
 
58
58
  describe '#get_leads' do
59
+ subject { client.get_leads(filter_type, filter_values) }
60
+
59
61
  let(:filter_type) { 'email' }
60
62
  let(:filter_values) { %w[user@example.com] }
61
63
  let(:response_stub) do
@@ -74,7 +76,6 @@ describe Mrkt::CrudLeads do
74
76
  success: true
75
77
  }
76
78
  end
77
- subject { client.get_leads(filter_type, filter_values) }
78
79
 
79
80
  before do
80
81
  stub_request(:get, "https://#{host}/rest/v1/leads.json")
@@ -86,6 +87,8 @@ describe Mrkt::CrudLeads do
86
87
  end
87
88
 
88
89
  describe '#createupdate_leads' do
90
+ subject { client.createupdate_leads(leads, lookup_field: :email) }
91
+
89
92
  let(:leads) do
90
93
  [
91
94
  firstName: 'John',
@@ -118,7 +121,6 @@ describe Mrkt::CrudLeads do
118
121
  ]
119
122
  }
120
123
  end
121
- subject { client.createupdate_leads(leads, lookup_field: :email) }
122
124
 
123
125
  before do
124
126
  stub_request(:post, "https://#{host}/rest/v1/leads.json")
@@ -130,6 +132,8 @@ describe Mrkt::CrudLeads do
130
132
  end
131
133
 
132
134
  describe '#delete_leads' do
135
+ subject { client.delete_leads(leads) }
136
+
133
137
  let(:leads) { [1] }
134
138
  let(:request_body) do
135
139
  {
@@ -147,7 +151,6 @@ describe Mrkt::CrudLeads do
147
151
  success: true
148
152
  }
149
153
  end
150
- subject { client.delete_leads(leads) }
151
154
 
152
155
  before do
153
156
  stub_request(:delete, "https://#{host}/rest/v1/leads.json")
@@ -159,12 +162,12 @@ describe Mrkt::CrudLeads do
159
162
  end
160
163
 
161
164
  describe '#associate_lead' do
165
+ subject(:action) { client.associate_lead(id, cookie) }
166
+
162
167
  let(:id) { 1 }
163
168
  let(:cookie) { 'id:561-HYG-937&token:_mch-marketo.com-1427205775289-40768' }
164
169
  let(:request_stub) { {} }
165
170
 
166
- subject { client.associate_lead(id, cookie) }
167
-
168
171
  before do
169
172
  stub_request(:post, "https://#{host}/rest/v1/leads/#{id}/associate.json?#{URI.encode_www_form(cookie: cookie)}")
170
173
  .with(json_stub(request_stub))
@@ -197,19 +200,19 @@ describe Mrkt::CrudLeads do
197
200
  }
198
201
  end
199
202
 
200
- it 'should raise an Error' do
201
- expect { subject }.to raise_error(Mrkt::Errors::LeadNotFound)
203
+ it 'raises an Error' do
204
+ expect { action }.to raise_error(Mrkt::Errors::LeadNotFound)
202
205
  end
203
206
  end
204
207
  end
205
208
 
206
209
  describe '#merge_leads' do
210
+ subject(:action) { client.merge_leads(id, losing_lead_ids) }
211
+
207
212
  let(:id) { 1 }
208
213
  let(:losing_lead_ids) { [2, 3, 4] }
209
214
  let(:request_stub) { {} }
210
215
 
211
- subject { client.merge_leads(id, losing_lead_ids) }
212
-
213
216
  before do
214
217
  params = ::Faraday::Utils::ParamsHash.new
215
218
  params[:mergeInCRM] = false
@@ -245,13 +248,15 @@ describe Mrkt::CrudLeads do
245
248
  }
246
249
  end
247
250
 
248
- it 'should raise an Error' do
249
- expect { subject }.to raise_error(Mrkt::Errors::LeadNotFound)
251
+ it 'raises an Error' do
252
+ expect { action }.to raise_error(Mrkt::Errors::LeadNotFound)
250
253
  end
251
254
  end
252
255
  end
253
256
 
254
257
  describe '#describe_lead' do
258
+ subject { client.describe_lead }
259
+
255
260
  let(:response_stub) do
256
261
  {
257
262
  requestId: '5c9e#169a68fa806',
@@ -289,8 +294,6 @@ describe Mrkt::CrudLeads do
289
294
  }
290
295
  end
291
296
 
292
- subject { client.describe_lead }
293
-
294
297
  before do
295
298
  stub_request(:get, "https://#{host}/rest/v1/leads/describe.json")
296
299
  .to_return(json_stub(response_stub))
@@ -1,7 +1,9 @@
1
1
  describe Mrkt::CrudLists do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#get_leads_by_list' do
5
+ subject { client.get_leads_by_list(list_id) }
6
+
5
7
  let(:list_id) { '1001' }
6
8
  let(:response_stub) do
7
9
  {
@@ -20,8 +22,6 @@ describe Mrkt::CrudLists do
20
22
  }
21
23
  end
22
24
 
23
- subject { client.get_leads_by_list(list_id) }
24
-
25
25
  before do
26
26
  stub_request(:get, "https://#{host}/rest/v1/list/#{list_id}/leads.json")
27
27
  .with(query: {})
@@ -32,6 +32,8 @@ describe Mrkt::CrudLists do
32
32
  end
33
33
 
34
34
  describe '#add_leads_to_list' do
35
+ subject { client.add_leads_to_list(list_id, lead_ids) }
36
+
35
37
  let(:list_id) { '1001' }
36
38
  let(:lead_ids) { ['1'] }
37
39
  let(:request_body) do
@@ -53,7 +55,6 @@ describe Mrkt::CrudLists do
53
55
  success: true
54
56
  }
55
57
  end
56
- subject { client.add_leads_to_list(list_id, lead_ids) }
57
58
 
58
59
  before do
59
60
  stub_request(:post, "https://#{host}/rest/v1/lists/#{list_id}/leads.json")
@@ -65,6 +66,8 @@ describe Mrkt::CrudLists do
65
66
  end
66
67
 
67
68
  describe '#remove_leads_from_list' do
69
+ subject { client.remove_leads_from_list(list_id, lead_ids) }
70
+
68
71
  let(:list_id) { '1001' }
69
72
  let(:lead_ids) { ['1'] }
70
73
  let(:request_body) do
@@ -86,7 +89,6 @@ describe Mrkt::CrudLists do
86
89
  success: true
87
90
  }
88
91
  end
89
- subject { client.remove_leads_from_list(list_id, lead_ids) }
90
92
 
91
93
  before do
92
94
  stub_request(:delete, "https://#{host}/rest/v1/lists/#{list_id}/leads.json")
@@ -0,0 +1,141 @@
1
+ describe Mrkt::CrudProgramMembers do
2
+ include_context 'with an initialized client'
3
+
4
+ describe '#describe_program_members' do
5
+ subject { client.describe_program_members }
6
+
7
+ let(:response_stub) do
8
+ {
9
+ requestId: 'c245#14cd6830ae2',
10
+ result: [
11
+ {
12
+ name: 'API Program Membership',
13
+ description: 'Map for API program membership fields',
14
+ dedupeFields: %w[
15
+ leadId
16
+ programId
17
+ ],
18
+ searchableFields: [
19
+ ['leadId'],
20
+ ['livestormregistrationurl']
21
+ ],
22
+ fields: [
23
+ {
24
+ name: 'acquiredBy',
25
+ displayName: 'acquiredBy',
26
+ dataType: 'boolean',
27
+ updateable: false,
28
+ crmManaged: false
29
+ },
30
+ {
31
+ name: 'attendanceLikelihood',
32
+ displayName: 'attendanceLikelihood',
33
+ dataType: 'integer',
34
+ updateable: false,
35
+ crmManaged: false
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ success: true
41
+ }
42
+ end
43
+
44
+ before do
45
+ stub_request(:get, "https://#{host}/rest/v1/programs/members/describe.json")
46
+ .to_return(json_stub(response_stub))
47
+ end
48
+
49
+ it { is_expected.to eq(response_stub) }
50
+ end
51
+
52
+ describe '#createupdate_program_members' do
53
+ subject { client.createupdate_program_members(program_id, lead_ids, status) }
54
+
55
+ let(:program_id) { 123 }
56
+ let(:lead_ids) { [1, 2, 3] }
57
+ let(:status) { 'Registered' }
58
+ let(:request_body) do
59
+ {
60
+ statusName: 'Registered',
61
+ input: [
62
+ { leadId: 1 },
63
+ { leadId: 2 },
64
+ { leadId: 3 }
65
+ ]
66
+ }
67
+ end
68
+ let(:response_stub) do
69
+ {
70
+ requestId: 'c00c#17d7bf40f15',
71
+ result: [
72
+ {
73
+ seq: 0,
74
+ status: 'created',
75
+ leadId: 1
76
+ },
77
+ {
78
+ seq: 1,
79
+ status: 'created',
80
+ leadId: 2
81
+ },
82
+ {
83
+ seq: 2,
84
+ status: 'created',
85
+ leadId: 3
86
+ }
87
+ ],
88
+ success: true
89
+ }
90
+ end
91
+
92
+ before do
93
+ stub_request(:post, "https://#{host}/rest/v1/programs/#{program_id}/members/status.json")
94
+ .with(json_stub(request_body))
95
+ .to_return(json_stub(response_stub))
96
+ end
97
+
98
+ it { is_expected.to eq(response_stub) }
99
+ end
100
+
101
+ describe '#get_program_members' do
102
+ subject { client.get_program_members(program_id, filter_type, filter_values) }
103
+
104
+ let(:filter_type) { 'leadId' }
105
+ let(:filter_values) { [1, 2] }
106
+ let(:program_id) { 1014 }
107
+ let(:response_stub) do
108
+ {
109
+ requestId: '4b6d#17d7c0530de',
110
+ result: [
111
+ {
112
+ seq: 0,
113
+ leadId: 1,
114
+ reachedSuccess: true,
115
+ programId: 1014,
116
+ acquiredBy: false,
117
+ membershipDate: '2021-12-02T16:22:12Z'
118
+ },
119
+ {
120
+ seq: 1,
121
+ leadId: 2,
122
+ reachedSuccess: true,
123
+ programId: 1014,
124
+ acquiredBy: false,
125
+ membershipDate: '2021-12-02T16:22:12Z'
126
+ }
127
+ ],
128
+ success: true,
129
+ moreResult: false
130
+ }
131
+ end
132
+
133
+ before do
134
+ stub_request(:get, "https://#{host}/rest/v1/programs/#{program_id}/members.json")
135
+ .with(query: { filterType: filter_type, filterValues: filter_values.join(',') })
136
+ .to_return(json_stub(response_stub))
137
+ end
138
+
139
+ it { is_expected.to eq(response_stub) }
140
+ end
141
+ end
@@ -1,7 +1,9 @@
1
1
  describe Mrkt::CrudPrograms do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#browse_programs' do
5
+ subject { client.browse_programs }
6
+
5
7
  let(:response_stub) do
6
8
  {
7
9
  success: true,
@@ -30,8 +32,6 @@ describe Mrkt::CrudPrograms do
30
32
  }
31
33
  end
32
34
 
33
- subject { client.browse_programs }
34
-
35
35
  before do
36
36
  stub_request(:get, "https://#{host}/rest/asset/v1/programs.json")
37
37
  .to_return(json_stub(response_stub))
@@ -41,6 +41,8 @@ describe Mrkt::CrudPrograms do
41
41
  end
42
42
 
43
43
  describe '#get_program_by_id' do
44
+ subject { client.get_program_by_id(1107) }
45
+
44
46
  let(:response_stub) do
45
47
  {
46
48
  success: true,
@@ -76,8 +78,6 @@ describe Mrkt::CrudPrograms do
76
78
  }
77
79
  end
78
80
 
79
- subject { client.get_program_by_id(1107) }
80
-
81
81
  before do
82
82
  stub_request(:get, "https://#{host}/rest/asset/v1/program/1107.json")
83
83
  .to_return(json_stub(response_stub))
@@ -1,10 +1,12 @@
1
1
  require 'tempfile'
2
2
 
3
3
  describe Mrkt::ImportCustomObjects do
4
- include_context 'initialized client'
4
+ include_context 'with an initialized client'
5
5
  let(:custom_object) { 'car_c' }
6
6
 
7
7
  describe '#import_custom_object' do
8
+ subject { client.import_custom_object(file, custom_object) }
9
+
8
10
  let(:file) { StringIO.new }
9
11
  let(:response_stub) do
10
12
  {
@@ -19,7 +21,6 @@ describe Mrkt::ImportCustomObjects do
19
21
  ]
20
22
  }
21
23
  end
22
- subject { client.import_custom_object(file, custom_object) }
23
24
 
24
25
  before do
25
26
  stub_request(:post, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import.json")
@@ -31,6 +32,8 @@ describe Mrkt::ImportCustomObjects do
31
32
  end
32
33
 
33
34
  describe '#import_custom_object_status' do
35
+ subject { client.import_custom_object_status(1, custom_object) }
36
+
34
37
  let(:id) { 1 }
35
38
  let(:response_stub) do
36
39
  {
@@ -51,7 +54,6 @@ describe Mrkt::ImportCustomObjects do
51
54
  success: true
52
55
  }
53
56
  end
54
- subject { client.import_custom_object_status(1, custom_object) }
55
57
 
56
58
  before do
57
59
  stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/status.json")
@@ -62,9 +64,10 @@ describe Mrkt::ImportCustomObjects do
62
64
  end
63
65
 
64
66
  describe '#import_custom_object_failures' do
67
+ subject { client.import_custom_object_failures(1, custom_object) }
68
+
65
69
  let(:id) { 1 }
66
70
  let(:response_stub) { '' }
67
- subject { client.import_custom_object_failures(1, custom_object) }
68
71
 
69
72
  before do
70
73
  stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/failures.json")
@@ -75,9 +78,10 @@ describe Mrkt::ImportCustomObjects do
75
78
  end
76
79
 
77
80
  describe '#import_custom_object_warnings' do
81
+ subject { client.import_custom_object_warnings(1, custom_object) }
82
+
78
83
  let(:id) { 1 }
79
84
  let(:response_stub) { '' }
80
- subject { client.import_custom_object_warnings(1, custom_object) }
81
85
 
82
86
  before do
83
87
  stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/warnings.json")
@@ -2,9 +2,11 @@ require 'csv'
2
2
  require 'tempfile'
3
3
 
4
4
  describe Mrkt::ImportLeads do
5
- include_context 'initialized client'
5
+ include_context 'with an initialized client'
6
6
 
7
7
  describe '#import_lead' do
8
+ subject { client.import_lead(tempfile) }
9
+
8
10
  let(:tempfile) { Tempfile.new(%w[import-leads csv]) }
9
11
  let(:response_stub) do
10
12
  {
@@ -18,7 +20,6 @@ describe Mrkt::ImportLeads do
18
20
  ]
19
21
  }
20
22
  end
21
- subject { client.import_lead(tempfile) }
22
23
 
23
24
  before do
24
25
  CSV.open(tempfile, 'wb') do |csv|
@@ -39,6 +40,8 @@ describe Mrkt::ImportLeads do
39
40
  end
40
41
 
41
42
  describe '#import_lead_status' do
43
+ subject { client.import_lead_status(1) }
44
+
42
45
  let(:id) { 1 }
43
46
  let(:response_stub) do
44
47
  {
@@ -56,7 +59,6 @@ describe Mrkt::ImportLeads do
56
59
  success: true
57
60
  }
58
61
  end
59
- subject { client.import_lead_status(1) }
60
62
 
61
63
  before do
62
64
  stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}.json")
@@ -67,9 +69,10 @@ describe Mrkt::ImportLeads do
67
69
  end
68
70
 
69
71
  describe '#import_lead_failures' do
72
+ subject { client.import_lead_failures(1) }
73
+
70
74
  let(:id) { 1 }
71
75
  let(:response_stub) { '' }
72
- subject { client.import_lead_failures(1) }
73
76
 
74
77
  before do
75
78
  stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}/failures.json")
@@ -80,9 +83,10 @@ describe Mrkt::ImportLeads do
80
83
  end
81
84
 
82
85
  describe '#import_lead_warnings' do
86
+ subject { client.import_lead_warnings(1) }
87
+
83
88
  let(:id) { 1 }
84
89
  let(:response_stub) { '' }
85
- subject { client.import_lead_warnings(1) }
86
90
 
87
91
  before do
88
92
  stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}/warnings.json")
data/spec/errors_spec.rb CHANGED
@@ -1,21 +1,19 @@
1
1
  describe Mrkt::Errors do
2
2
  describe '.find_by_response_code' do
3
- subject { described_class.find_by_response_code(code) }
3
+ subject(:actual) { described_class.find_by_response_code(code) }
4
4
 
5
- context 'when the code is' do
6
- context 'known' do
7
- let(:code) { 413 }
5
+ context 'when the code is known' do
6
+ let(:code) { 413 }
8
7
 
9
- it 'should return the mapped error class' do
10
- is_expected.to eq(Mrkt::Errors::RequestEntityTooLarge)
11
- end
8
+ it 'returns the mapped error class' do
9
+ expect(actual).to eq(Mrkt::Errors::RequestEntityTooLarge)
12
10
  end
11
+ end
13
12
 
14
- context 'unknown' do
15
- let(:code) { 7331 }
13
+ context 'when the code is unknown' do
14
+ let(:code) { 7331 }
16
15
 
17
- it { is_expected.to eq(Mrkt::Errors::Error) }
18
- end
16
+ it { is_expected.to eq(Mrkt::Errors::Error) }
19
17
  end
20
18
  end
21
19
  end