-
-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathslack_error_spec.rb
More file actions
33 lines (30 loc) · 1.24 KB
/
slack_error_spec.rb
File metadata and controls
33 lines (30 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Slack::Web::Api::Errors::SlackError do
let(:client) { Slack::Web::Client.new }
it 'provides access to the response object', vcr: { cassette_name: 'web/auth_test_error' } do
client.auth_test
raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
rescue described_class => e
expect(e.response).not_to be_nil
expect(e.response.status).to eq 200
expect(e.message).to eql 'not_authed'
expect(e.error).to eql 'not_authed'
expect(e.response_metadata).to be_nil
end
it 'provides access to any response_metadata', vcr: { cassette_name: 'web/views_open_error' } do
client.views_open(trigger_id: 'trigger_id', view: {})
raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
rescue described_class => e
expect(e.response).not_to be_nil
expect(e.response.status).to eq 200
expect(e.message).to eql "invalid_arguments, response_metadata=#{e.response_metadata}"
expect(e.error).to eql 'invalid_arguments'
expect(e.response_metadata).to eq(
'messages' => [
'[ERROR] failed to match all allowed schemas [json-pointer:/view]',
'[ERROR] missing required field: type [json-pointer:/view]'
]
)
end
end