Sha256: d5f5792182909585b3f4508d6f03dcdcd5fd2fc24e39177f63e8f09b9afec09e

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

# 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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
usps-ruby-client-0.2.0 lib/usps/api/templates/method_spec.erb
usps-ruby-client-0.1.3 lib/usps/api/templates/method_spec.erb
usps-ruby-client-0.1.2 lib/usps/api/templates/method_spec.erb
usps-ruby-client-0.1.1 lib/usps/api/templates/method_spec.erb
usps-ruby-client-0.1.0 lib/usps/api/templates/method_spec.erb