# frozen_string_literal: true # This file was auto-generated by lib/tasks/api.rake require 'spec_helper' RSpec.describe Usps::Api::Endpoints::<%= data[:group].camelize %> do let(:client) { Usps::Client.new } <% [data[:group]].sort.each_with_index do |(name), index| %> <% next if data['mixin'] %> <% required_params = data[:request_descriptions].select{|n,o| o[:required]} %> <% next if required_params.none? %> context '<%= data[:group].underscore %>' do <% required_params.each do |arg_name, arg_v| %> it 'requires <%= arg_name.underscore %>' do <% params_except_required = required_params.reject{ |name, _| name == arg_name }.map{|var, opts| "#{var}: '#{opts['example']}'"}.join(', ') %> expect { client.<%= group.underscore %><%= params_except_required.empty? ? '' : "(#{params_except_required})" %> }.to raise_error ArgumentError, /Required arguments :<%= arg_name.underscore %> missing/ end <% end %> end <% end %> end