Sha256: 7dc1fc7da78f576fad5b7c3d9aff3129abbf8251094c8cb76aa35c0e2e76782d

Contents?: true

Size: 945 Bytes

Versions: 6

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

require 'spec_helper'

RSpec.describe Slack::Web::Api::Endpoints::<%= group.gsub(".", "_").camelize %> do
  let(:client) { Slack::Web::Client.new }
<% names.sort.each_with_index do |(name, data), index| %>
<% next if data['mixin'] %>
<% required_params = data['args'].select{ |k, v| v['required'] } %>
<% next if required_params.none? %>
  context '<%= group %>_<%= name %>' do
<% required_params.each do |arg_name, arg_v| %>
    it 'requires <%= arg_name %>' do
<% params_except_required = required_params.reject{ |name, _| name == arg_name  }.map{ |var, opts| "#{var}: %q[#{opts['example']}]"}.join(', ') %>
      expect { client.<%= group.gsub(".", "_") %>_<%= name %><%= params_except_required.empty? ? '' : "(#{params_except_required})" %> }.to raise_error ArgumentError, /Required arguments :<%= arg_name %> missing/
    end
<% end %>
  end
<% end %>
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slack-ruby-client-2.1.0 lib/slack/web/api/templates/method_spec.erb
slack-ruby-client-2.0.0 lib/slack/web/api/templates/method_spec.erb
slack-ruby-client-1.1.0 lib/slack/web/api/templates/method_spec.erb
slack-ruby-client-1.0.0 lib/slack/web/api/templates/method_spec.erb
slack-ruby-client-0.17.0 lib/slack/web/api/templates/method_spec.erb
slack-ruby-client-0.16.0 lib/slack/web/api/templates/method_spec.erb