Skip to content

Commit aacbfab

Browse files
committed
Fix argument matchers in specs
1 parent 96e9d9a commit aacbfab

13 files changed

+32
-30
lines changed

.rubocop.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Metrics/AbcSize:
1818
Metrics/CyclomaticComplexity:
1919
Enabled: false
2020
Metrics/BlockLength:
21-
Enabled: false
21+
Enabled: false
2222
Style/Documentation:
2323
Enabled: false
2424
Style/GuardClause:
2525
Enabled: false
2626
Style/ConditionalAssignment:
27-
Enabled: false
27+
Enabled: false
2828
Style/IfUnlessModifier:
2929
Enabled: false
3030
Style/WordArray:
@@ -34,4 +34,6 @@ Layout/ClosingParenthesisIndentation:
3434
Style/PercentLiteralDelimiters:
3535
Enabled: false
3636
Style/SymbolArray:
37-
Enabled: false
37+
Enabled: false
38+
Style/BracesAroundHashParameters:
39+
Enabled: false

spec/call_flow_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
}
4343
expect(voice_client)
4444
.to receive(:request)
45-
.with(:post, 'call-flows', title: title, steps: steps, default: default, record: record)
45+
.with(:post, 'call-flows', { title: title, steps: steps, default: default, record: record })
4646
.and_return(mock_data.to_json)
4747

4848
call_flow = client.call_flow_create(title, steps, default, record)

spec/call_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
it 'create a call' do
3939
expect(voice_client)
4040
.to receive(:request)
41-
.with(:post, 'calls', source: source, destination: destination, callFlow: call_flow.to_json)
41+
.with(:post, 'calls', { source: source, destination: destination, callFlow: call_flow.to_json })
4242
.and_return('{"data":[{"id":"' + call_id + '","status":"queued","source":"' + source + '","destination":"' + destination + '","createdAt":"2019-10-11T13:02:19Z","updatedAt":"2019-10-11T13:02:19Z","endedAt":null}],"_links":{"self":"/calls/' + call_id + '"},"pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0}}')
4343
call = client.call_create(source, destination, call_flow)
4444
expect(call.id).to eq call_id
@@ -47,7 +47,7 @@
4747
it 'create a call with webhook' do
4848
expect(voice_client)
4949
.to receive(:request)
50-
.with(:post, 'calls', source: source, destination: destination, callFlow: call_flow.to_json, webhook: webhook.to_json)
50+
.with(:post, 'calls', { source: source, destination: destination, callFlow: call_flow.to_json, webhook: webhook.to_json })
5151
.and_return('{"data":[{"id":"' + call_id + '","status":"queued","source":"' + source + '","destination":"' + destination + '","createdAt":"2019-10-11T13:02:19Z","updatedAt":"2019-10-11T13:02:19Z","endedAt":null, "webhook":' + webhook.to_json + '}],"_links":{"self":"/calls/' + call_id + '"},"pagination":{"total_count":0,"pageCount":0,"currentPage":0,"perPage":0}}')
5252
call = client.call_create(source, destination, call_flow, webhook)
5353
expect(call.id).to eq call_id

spec/contact_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
expect(http_client)
99
.to receive(:request)
10-
.with(:post, 'contacts', msisdn: '31612345678', first_name: 'Foo', last_name: 'Bar', custom1: 'First', custom4: 'Fourth')
10+
.with(:post, 'contacts', { msisdn: '31612345678', first_name: 'Foo', last_name: 'Bar', custom1: 'First', custom4: 'Fourth' })
1111
.and_return('{}')
1212

1313
client.contact_create(31_612_345_678, first_name: 'Foo', last_name: 'Bar', custom1: 'First', custom4: 'Fourth')
@@ -108,7 +108,7 @@
108108

109109
expect(http_client)
110110
.to receive(:request)
111-
.with(:patch, 'contacts/contact-id', msisdn: 31_687_654_321, custom3: 'Third')
111+
.with(:patch, 'contacts/contact-id', { msisdn: 31_687_654_321, custom3: 'Third' })
112112
.and_return('')
113113

114114
client.contact_update('contact-id', msisdn: 31_687_654_321, custom3: 'Third')

spec/conversation_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
expect(conversation_client)
99
.to receive(:request)
10-
.with(:post, 'send', from: 'MBTest', to: 31_612_345_678, type: 'text', content: { text: 'Hi there!' })
10+
.with(:post, 'send', { from: 'MBTest', to: 31_612_345_678, type: 'text', content: { text: 'Hi there!' } })
1111
.and_return('{}')
1212

1313
client.send_conversation_message('MBTest', 31_612_345_678, type: 'text', content: { text: 'Hi there!' })
@@ -19,7 +19,7 @@
1919

2020
expect(conversation_client)
2121
.to receive(:request)
22-
.with(:post, 'conversations/start', channel_id: 'c0dae31e440145e094c4708b7d000000', to: 31_612_345_678, type: 'text', content: { text: 'Hi there!' })
22+
.with(:post, 'conversations/start', { channel_id: 'c0dae31e440145e094c4708b7d000000', to: 31_612_345_678, type: 'text', content: { text: 'Hi there!' } })
2323
.and_return('{}')
2424

2525
client.start_conversation(31_612_345_678, 'c0dae31e440145e094c4708b7d000000', type: 'text', content: { text: 'Hi there!' })
@@ -109,7 +109,7 @@
109109

110110
expect(conversation_client)
111111
.to receive(:request)
112-
.with(:patch, 'conversations/conversation-id', status: MessageBird::Conversation::CONVERSATION_STATUS_ARCHIVED)
112+
.with(:patch, 'conversations/conversation-id', { status: MessageBird::Conversation::CONVERSATION_STATUS_ARCHIVED })
113113
.and_return('{"id":"conversation-id", "contactId": "contact-id"}')
114114
conversation = client.conversation_update('conversation-id', MessageBird::Conversation::CONVERSATION_STATUS_ARCHIVED)
115115

@@ -123,7 +123,7 @@
123123

124124
expect(conversation_client)
125125
.to receive(:request)
126-
.with(:post, 'conversations/conversation-id/messages', type: 'text', content: { text: 'Hi there' })
126+
.with(:post, 'conversations/conversation-id/messages', { type: 'text', content: { text: 'Hi there' } })
127127
.and_return({ id: 'message-id', channel_id: 'channel-id', conversationId: 'conversation-id' }.to_json)
128128

129129
msg = client.conversation_reply('conversation-id', type: 'text', content: { text: 'Hi there' })
@@ -168,7 +168,7 @@
168168

169169
expect(conversation_client)
170170
.to receive(:request)
171-
.with(:post, 'webhooks', channel_id: 'channel-id', events: [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED, MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_UPDATED], url: 'url')
171+
.with(:post, 'webhooks', { channel_id: 'channel-id', events: [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED, MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_UPDATED], url: 'url' })
172172
.and_return('{"id":"00000000000000000000000000000000", "events": ["message.created", "message.updated"]}')
173173

174174
webhook = client.conversation_webhook_create('channel-id', 'url', [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED, MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_UPDATED])
@@ -212,7 +212,7 @@
212212

213213
expect(conversation_client)
214214
.to receive(:request)
215-
.with(:patch, 'webhooks/webhook-id', events: [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED], url: 'url')
215+
.with(:patch, 'webhooks/webhook-id', { events: [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED], url: 'url' })
216216
.and_return('{"id":"00000000000000000000000000000000", "events": ["message.created"]}')
217217

218218
webhook = client.conversation_webhook_update('webhook-id', events: [MessageBird::Conversation::WEBHOOK_EVENT_MESSAGE_CREATED], url: 'url')

spec/group_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
expect(http_client)
99
.to receive(:request)
10-
.with(:post, 'groups', name: 'friends')
10+
.with(:post, 'groups', { name: 'friends' })
1111
.and_return('{}')
1212

1313
client.group_create('friends')
@@ -76,7 +76,7 @@
7676

7777
expect(http_client)
7878
.to receive(:request)
79-
.with(:patch, 'groups/group-id', name: 'family')
79+
.with(:patch, 'groups/group-id', { name: 'family' })
8080
.and_return('{}')
8181

8282
client.group_update('group-id', 'family')

spec/hlr_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
expect(http_client)
2323
.to receive(:request)
24-
.with(:post, 'hlr', msisdn: 31_612_345_678, reference: 'MyReference')
24+
.with(:post, 'hlr', { msisdn: 31_612_345_678, reference: 'MyReference' })
2525
.and_return('{}')
2626

2727
client.hlr_create(31_612_345_678, 'MyReference')

spec/lookup_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
expect(http_client)
2424
.to receive(:request)
25-
.with(:get, 'lookup/0612345678', country_code: 'NL')
25+
.with(:get, 'lookup/0612345678', { country_code: 'NL' })
2626
.and_return('{"href": "https://rest.messagebird.com/lookup/31612345678","countryCode": "NL","countryPrefix": 31,"phoneNumber": 31612345678,"type": "mobile","formats": {"e164": "+31612345678","international": "+31 6 12345678","national": "06 12345678","rfc3966": "tel:+31-6-12345678"},"hlr": {"id": "hlr-id","network": 20416,"reference": "reference2000","status": "active","createdDatetime": "2015-12-15T08:19:24+00:00","statusDatetime": "2015-12-15T08:19:25+00:00"}}')
2727

2828
lookup = client.lookup('0612345678', country_code: 'NL')
@@ -53,7 +53,7 @@
5353

5454
expect(http_client)
5555
.to receive(:request)
56-
.with(:post, 'lookup/31612345678/hlr', reference: 'MyReference')
56+
.with(:post, 'lookup/31612345678/hlr', { reference: 'MyReference' })
5757
.and_return('{}')
5858

5959
client.lookup_hlr_create(31_612_345_678, reference: 'MyReference')

spec/message_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
expect(http_client)
2323
.to receive(:request)
24-
.with(:post, 'messages', originator: 'MBTest', recipients: 31_612_345_678, body: 'Hello world', reference: 'Foo')
24+
.with(:post, 'messages', { originator: 'MBTest', recipients: 31_612_345_678, body: 'Hello world', reference: 'Foo' })
2525
.and_return('{}')
2626

2727
client.message_create('MBTest', 31_612_345_678, 'Hello world', reference: 'Foo')

spec/number_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
expect(http_client)
99
.to receive(:request)
10-
.with(:get, 'available-phone-numbers/NL?limit=5', limit: 5)
10+
.with(:get, 'available-phone-numbers/NL?limit=5', { limit: 5 })
1111
.and_return('{"items": [{"number": "3197010260188","country": "NL","region": "","locality": "","features": ["sms","voice"],"type": "mobile"},{"number": "3197010260188","country": "NL","region": "","locality": "","features": ["sms","voice"],"type": "mobile"}],"limit": 5,"count": 2}')
1212

1313
numbers = client.number_search('NL', limit: 5)
@@ -24,7 +24,7 @@
2424

2525
expect(http_client)
2626
.to receive(:request)
27-
.with(:post, 'phone-numbers', number: '31971234567', countryCode: 'NL', billingIntervalMonths: 1)
27+
.with(:post, 'phone-numbers', { number: '31971234567', countryCode: 'NL', billingIntervalMonths: 1 })
2828
.and_return('{"number": "31971234567","country": "NL","region": "Haarlem","locality": "Haarlem","features": ["sms","voice"],"tags": [],"type": "landline_or_mobile","status": "active","createdAt": "2019-04-25T14:04:04Z","renewalAt": "2019-05-25T00:00:00Z"}')
2929

3030
number = client.number_purchase('31971234567', 'NL', 1)
@@ -47,7 +47,7 @@
4747

4848
expect(http_client)
4949
.to receive(:request)
50-
.with(:get, 'phone-numbers?type=mobile&features=sms&features=voice', type: 'mobile', features: ['sms', 'voice'])
50+
.with(:get, 'phone-numbers?type=mobile&features=sms&features=voice', { type: 'mobile', features: ['sms', 'voice'] })
5151
.and_return('{"offset": 0,"limit": 20,"count": 1,"totalCount": 1,"items": [{"number": "31612345670","country": "NL","region": "Texel","locality": "Texel","features": ["sms","voice"],"tags": [],"type": "mobile","status": "active"}]}')
5252

5353
numbers = client.number_fetch_all(type: 'mobile', features: ['sms', 'voice'])
@@ -90,7 +90,7 @@
9090

9191
expect(http_client)
9292
.to receive(:request)
93-
.with(:patch, 'phone-numbers/31612345670', tags: ['tag1'])
93+
.with(:patch, 'phone-numbers/31612345670', { tags: ['tag1'] })
9494
.and_return('{"number": "31612345670","country": "NL","region": "Texel","locality": "Texel","features": ["sms","voice"],"tags": ["tag1"],"type": "mobile","status": "active"}')
9595

9696
number = client.number_update('31612345670', ['tag1'])

spec/verify_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
it 'creates a verify and sends token' do
3131
expect(@http_client)
3232
.to receive(:request)
33-
.with(:post, 'verify', recipient: 31_612_345_678, originator: 'MessageBird')
33+
.with(:post, 'verify', { recipient: 31_612_345_678, originator: 'MessageBird' })
3434
.and_return('{}')
3535

3636
@client.verify_create(31_612_345_678, originator: 'MessageBird')
@@ -39,7 +39,7 @@
3939
it 'creates a verify and sends token via email' do
4040
expect(@http_client)
4141
.to receive(:request)
42-
.with(:post, 'verify', type: 'email', recipient: '[email protected]', subject: 'Your verification code', originator: 'MessageBird')
42+
.with(:post, 'verify', { type: 'email', recipient: '[email protected]', subject: 'Your verification code', originator: 'MessageBird' })
4343
.and_return('{}')
4444

4545
@client.verify_create('[email protected]', originator: 'MessageBird', type: 'email', subject: 'Your verification code')

spec/voice_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
expect(voice_client)
99
.to receive(:request)
10-
.with(:post, 'webhooks', url: 'https://test.com', token: 'sometoken')
10+
.with(:post, 'webhooks', { url: 'https://test.com', token: 'sometoken' })
1111
.and_return('{"data":[{"id":"00000000000000000000000000000000", "url": "https://test.com", "token": "sometoken"}]}')
1212

1313
webhook = client.voice_webhook_create('https://test.com', token: 'sometoken')
@@ -53,7 +53,7 @@
5353

5454
expect(voice_client)
5555
.to receive(:request)
56-
.with(:put, 'webhooks/webhook-id', url: 'https://test.com', token: 'sometoken')
56+
.with(:put, 'webhooks/webhook-id', { url: 'https://test.com', token: 'sometoken' })
5757
.and_return('{"data":[{"id":"00000000000000000000000000000000", "url": "https://test.com", "token": "sometoken"}]}')
5858

5959
webhook = client.voice_webhook_update('webhook-id', url: 'https://test.com', token: 'sometoken')

spec/voicemessage_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
expect(http_client)
2323
.to receive(:request)
24-
.with(:post, 'voicemessages', recipients: 31_612_345_678, body: 'Body', repeat: 3)
24+
.with(:post, 'voicemessages', { recipients: 31_612_345_678, body: 'Body', repeat: 3 })
2525
.and_return('{}')
2626

2727
client.voice_message_create(31_612_345_678, 'Body', repeat: 3)
@@ -33,7 +33,7 @@
3333

3434
expect(http_client)
3535
.to receive(:request)
36-
.with(:post, 'voicemessages', recipients: '31612345678,31687654321', body: 'Body', repeat: 3)
36+
.with(:post, 'voicemessages', { recipients: '31612345678,31687654321', body: 'Body', repeat: 3 })
3737
.and_return('{}')
3838

3939
client.voice_message_create([31_612_345_678, 31_687_654_321], 'Body', repeat: 3)

0 commit comments

Comments
 (0)