Skip to content

Commit 9a2c893

Browse files
committed
Remove custom_specs override.
1 parent 71d08ec commit 9a2c893

File tree

16 files changed

+282
-17
lines changed

16 files changed

+282
-17
lines changed

.rubocop_todo.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-02-08 15:52:13 UTC using RuboCop version 1.26.1.
3+
# on 2025-02-09 15:50:36 UTC using RuboCop version 1.26.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -73,7 +73,7 @@ Metrics/PerceivedComplexity:
7373
# Configuration parameters: MinSize.
7474
Performance/CollectionLiteralInLoop:
7575
Exclude:
76-
- 'spec/slack/web/api/endpoints/custom_specs/files_spec.rb'
76+
- 'spec/slack/web/api/endpoints/custom/files_spec.rb'
7777

7878
# Offense count: 1
7979
# This cop supports safe auto-correction (--auto-correct).
@@ -178,13 +178,6 @@ Rake/Desc:
178178
Exclude:
179179
- 'lib/tasks/git.rake'
180180

181-
# Offense count: 1
182-
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
183-
# SupportedStyles: inline, group
184-
Style/AccessModifierDeclarations:
185-
Exclude:
186-
- 'lib/slack/real_time/client.rb'
187-
188181
# Offense count: 4
189182
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
190183
# SupportedStyles: annotated, template, unannotated
@@ -204,7 +197,7 @@ Style/GlobalStdStream:
204197
# This cop supports unsafe auto-correction (--auto-correct-all).
205198
Style/MapToHash:
206199
Exclude:
207-
- 'spec/slack/web/api/endpoints/custom_specs/files_spec.rb'
200+
- 'spec/slack/web/api/endpoints/custom/files_spec.rb'
208201

209202
# Offense count: 1
210203
Style/MultilineBlockChain:
@@ -220,7 +213,7 @@ Style/MultilineTernaryOperator:
220213
# Offense count: 3
221214
Style/OpenStructUse:
222215
Exclude:
223-
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
216+
- 'spec/slack/web/api/endpoints/custom/chat_spec.rb'
224217
- 'spec/slack/web/api/pagination/cursor_spec.rb'
225218
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
226219

lib/slack/web/api/templates/method_spec.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ RSpec.describe Slack::Web::Api::Endpoints::<%= group.gsub(".", "_").camelize %>
1111
<% required_params = data['args'].select{ |k, v| v['required'] } %>
1212
<% all_required_params = data['args'].select{ |k, v| v['required'] || group_required_params.include?(k) } %>
1313
<% json_params = data['args'].map { |arg_name, arg_v| arg_name if arg_v['format'] == 'json' }.compact %>
14-
<% next if (all_required_params.none? || custom_spec_exists) && json_params.none? && data['arg_groups'].nil? %>
14+
<% next if all_required_params.none? && json_params.none? && data['arg_groups'].nil? %>
1515
<% method_name = [group.gsub(".", "_"), name].join('_') %>
1616
<% example_params = all_required_params.to_h { |var, opts| [var, opts['example']] } %>
1717
context '<%= group %>_<%= name %>' do
18-
<% unless custom_spec_exists %>
1918
<% required_params.each do |arg_name, arg_v| %>
2019
it 'requires <%= arg_name %>' do
2120
<% params_except_required = example_params.reject { |name, _| name == arg_name }.map { |name, val| "#{name}: %q[#{val}]" }.join(', ') %>
2221
expect { client.<%= method_name %><%= params_except_required.empty? ? '' : "(#{params_except_required})" %> }.to raise_error ArgumentError, /Required arguments :<%= arg_name %> missing/
2322
end
2423
<% end %>
25-
<% end %>
2624
<% data['arg_groups']&.each do |arg_group| %>
2725
<% next if arg_group['args'].size <= 1 %>
2826
it 'requires one of <%= arg_group['args'].join(', ') %>' do

lib/tasks/web.rake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ namespace :slack do
5656
snaked_group = group.tr('.', '_')
5757
rendered_method = method_template.result(group: group, names: names)
5858
File.write "lib/slack/web/api/endpoints/#{snaked_group}.rb", rendered_method
59-
custom_spec_exists =
60-
File.exist?("spec/slack/web/api/endpoints/custom_specs/#{group}_spec.rb")
61-
rendered_method_spec = method_spec_template.result(group: group, names: names, custom_spec_exists: custom_spec_exists)
59+
rendered_method_spec = method_spec_template.result(group: group, names: names)
6260
File.write "spec/slack/web/api/endpoints/#{snaked_group}_spec.rb", rendered_method_spec
6361

6462
unless ENV.key?('SKIP_PATCH')

spec/slack/web/api/endpoints/chat_spec.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,53 @@
55

66
RSpec.describe Slack::Web::Api::Endpoints::Chat do
77
let(:client) { Slack::Web::Client.new }
8+
context 'chat_command' do
9+
it 'requires channel' do
10+
expect { client.chat_command(command: %q[/who]) }.to raise_error ArgumentError, /Required arguments :channel missing/
11+
end
12+
it 'requires command' do
13+
expect { client.chat_command(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :command missing/
14+
end
15+
end
16+
context 'chat_delete' do
17+
it 'requires channel' do
18+
expect { client.chat_delete(ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Required arguments :channel missing/
19+
end
20+
it 'requires ts' do
21+
expect { client.chat_delete(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :ts missing/
22+
end
23+
end
24+
context 'chat_deleteScheduledMessage' do
25+
it 'requires channel' do
26+
expect { client.chat_deleteScheduledMessage(scheduled_message_id: %q[Q1234ABCD]) }.to raise_error ArgumentError, /Required arguments :channel missing/
27+
end
28+
it 'requires scheduled_message_id' do
29+
expect { client.chat_deleteScheduledMessage(channel: %q[C123456789]) }.to raise_error ArgumentError, /Required arguments :scheduled_message_id missing/
30+
end
31+
end
32+
context 'chat_getPermalink' do
33+
it 'requires channel' do
34+
expect { client.chat_getPermalink(message_ts: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :channel missing/
35+
end
36+
it 'requires message_ts' do
37+
expect { client.chat_getPermalink(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :message_ts missing/
38+
end
39+
end
40+
context 'chat_meMessage' do
41+
it 'requires channel' do
42+
expect { client.chat_meMessage(text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :channel missing/
43+
end
44+
it 'requires text' do
45+
expect { client.chat_meMessage(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :text missing/
46+
end
47+
end
848
context 'chat_postEphemeral' do
49+
it 'requires channel' do
50+
expect { client.chat_postEphemeral(user: %q[U0BPQUNTA], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/
51+
end
52+
it 'requires user' do
53+
expect { client.chat_postEphemeral(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :user missing/
54+
end
955
it 'requires one of attachments, blocks, text' do
1056
expect { client.chat_postEphemeral(channel: %q[C1234567890], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /At least one of/
1157

@@ -36,6 +82,9 @@
3682
end
3783
end
3884
context 'chat_postMessage' do
85+
it 'requires channel' do
86+
expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/
87+
end
3988
it 'requires one of attachments, blocks, text' do
4089
expect { client.chat_postMessage(channel: %q[C1234567890]) }.to raise_error ArgumentError, /At least one of/
4190

@@ -66,6 +115,12 @@
66115
end
67116
end
68117
context 'chat_scheduleMessage' do
118+
it 'requires channel' do
119+
expect { client.chat_scheduleMessage(post_at: %q[299876400], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/
120+
end
121+
it 'requires post_at' do
122+
expect { client.chat_scheduleMessage(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :post_at missing/
123+
end
69124
it 'requires one of attachments, blocks, text' do
70125
expect { client.chat_scheduleMessage(channel: %q[C1234567890], post_at: %q[299876400]) }.to raise_error ArgumentError, /At least one of/
71126

@@ -96,12 +151,27 @@
96151
end
97152
end
98153
context 'chat_unfurl' do
154+
it 'requires channel' do
155+
expect { client.chat_unfurl(ts: %q[], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :channel missing/
156+
end
157+
it 'requires ts' do
158+
expect { client.chat_unfurl(channel: %q[C1234567890], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :ts missing/
159+
end
160+
it 'requires unfurls' do
161+
expect { client.chat_unfurl(channel: %q[C1234567890], ts: %q[]) }.to raise_error ArgumentError, /Required arguments :unfurls missing/
162+
end
99163
it 'encodes unfurls, user_auth_blocks as json' do
100164
expect(client).to receive(:post).with('chat.unfurl', {channel: %q[C1234567890], ts: %q[], unfurls: %q[{"data":["data"]}], user_auth_blocks: %q[{"data":["data"]}]})
101165
client.chat_unfurl(channel: %q[C1234567890], ts: %q[], unfurls: {:data=>["data"]}, user_auth_blocks: {:data=>["data"]})
102166
end
103167
end
104168
context 'chat_update' do
169+
it 'requires channel' do
170+
expect { client.chat_update(ts: %q["1405894322.002768"], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/
171+
end
172+
it 'requires ts' do
173+
expect { client.chat_update(channel: %q[C1234567890], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :ts missing/
174+
end
105175
it 'requires one of attachments, blocks, text' do
106176
expect { client.chat_update(channel: %q[C1234567890], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /At least one of/
107177

spec/slack/web/api/endpoints/conversations_spec.rb

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,125 @@
55

66
RSpec.describe Slack::Web::Api::Endpoints::Conversations do
77
let(:client) { Slack::Web::Client.new }
8+
context 'conversations_acceptSharedInvite' do
9+
it 'requires channel_name' do
10+
expect { client.conversations_acceptSharedInvite }.to raise_error ArgumentError, /Required arguments :channel_name missing/
11+
end
12+
end
13+
context 'conversations_approveSharedInvite' do
14+
it 'requires invite_id' do
15+
expect { client.conversations_approveSharedInvite }.to raise_error ArgumentError, /Required arguments :invite_id missing/
16+
end
17+
end
18+
context 'conversations_archive' do
19+
it 'requires channel' do
20+
expect { client.conversations_archive }.to raise_error ArgumentError, /Required arguments :channel missing/
21+
end
22+
end
23+
context 'conversations_close' do
24+
it 'requires channel' do
25+
expect { client.conversations_close }.to raise_error ArgumentError, /Required arguments :channel missing/
26+
end
27+
end
28+
context 'conversations_create' do
29+
it 'requires name' do
30+
expect { client.conversations_create }.to raise_error ArgumentError, /Required arguments :name missing/
31+
end
32+
end
33+
context 'conversations_declineSharedInvite' do
34+
it 'requires invite_id' do
35+
expect { client.conversations_declineSharedInvite }.to raise_error ArgumentError, /Required arguments :invite_id missing/
36+
end
37+
end
38+
context 'conversations_history' do
39+
it 'requires channel' do
40+
expect { client.conversations_history }.to raise_error ArgumentError, /Required arguments :channel missing/
41+
end
42+
end
43+
context 'conversations_info' do
44+
it 'requires channel' do
45+
expect { client.conversations_info }.to raise_error ArgumentError, /Required arguments :channel missing/
46+
end
47+
end
48+
context 'conversations_invite' do
49+
it 'requires channel' do
50+
expect { client.conversations_invite(users: %q[W1234567890,U2345678901,U3456789012]) }.to raise_error ArgumentError, /Required arguments :channel missing/
51+
end
52+
it 'requires users' do
53+
expect { client.conversations_invite(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :users missing/
54+
end
55+
end
56+
context 'conversations_inviteShared' do
57+
it 'requires channel' do
58+
expect { client.conversations_inviteShared }.to raise_error ArgumentError, /Required arguments :channel missing/
59+
end
60+
end
61+
context 'conversations_join' do
62+
it 'requires channel' do
63+
expect { client.conversations_join }.to raise_error ArgumentError, /Required arguments :channel missing/
64+
end
65+
end
66+
context 'conversations_kick' do
67+
it 'requires channel' do
68+
expect { client.conversations_kick(user: %q[W1234567890]) }.to raise_error ArgumentError, /Required arguments :channel missing/
69+
end
70+
it 'requires user' do
71+
expect { client.conversations_kick(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :user missing/
72+
end
73+
end
74+
context 'conversations_leave' do
75+
it 'requires channel' do
76+
expect { client.conversations_leave }.to raise_error ArgumentError, /Required arguments :channel missing/
77+
end
78+
end
79+
context 'conversations_mark' do
80+
it 'requires channel' do
81+
expect { client.conversations_mark(ts: %q[1593473566.000200]) }.to raise_error ArgumentError, /Required arguments :channel missing/
82+
end
83+
it 'requires ts' do
84+
expect { client.conversations_mark(channel: %q[C012345678]) }.to raise_error ArgumentError, /Required arguments :ts missing/
85+
end
86+
end
87+
context 'conversations_members' do
88+
it 'requires channel' do
89+
expect { client.conversations_members }.to raise_error ArgumentError, /Required arguments :channel missing/
90+
end
91+
end
92+
context 'conversations_rename' do
93+
it 'requires channel' do
94+
expect { client.conversations_rename(name: %q[]) }.to raise_error ArgumentError, /Required arguments :channel missing/
95+
end
96+
it 'requires name' do
97+
expect { client.conversations_rename(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :name missing/
98+
end
99+
end
100+
context 'conversations_replies' do
101+
it 'requires channel' do
102+
expect { client.conversations_replies(ts: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :channel missing/
103+
end
104+
it 'requires ts' do
105+
expect { client.conversations_replies(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :ts missing/
106+
end
107+
end
108+
context 'conversations_setPurpose' do
109+
it 'requires channel' do
110+
expect { client.conversations_setPurpose(purpose: %q[This is the random channel, anything goes!]) }.to raise_error ArgumentError, /Required arguments :channel missing/
111+
end
112+
it 'requires purpose' do
113+
expect { client.conversations_setPurpose(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :purpose missing/
114+
end
115+
end
116+
context 'conversations_setTopic' do
117+
it 'requires channel' do
118+
expect { client.conversations_setTopic(topic: %q[Apply topically for best effects]) }.to raise_error ArgumentError, /Required arguments :channel missing/
119+
end
120+
it 'requires topic' do
121+
expect { client.conversations_setTopic(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :topic missing/
122+
end
123+
end
124+
context 'conversations_unarchive' do
125+
it 'requires channel' do
126+
expect { client.conversations_unarchive }.to raise_error ArgumentError, /Required arguments :channel missing/
127+
end
128+
end
8129
end
File renamed without changes.
File renamed without changes.

spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb renamed to spec/slack/web/api/endpoints/custom/conversations_spec.rb

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)