Sha256: 0714b539f3383e4ea21e06a26cf0f419ac9518f22601868765cb1dafd54d2995
Contents?: true
Size: 1.02 KB
Versions: 13
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require 'generators/rspec' require_relative '../generator_helper' module Rspec module Generators # rails g rspec:api_client class ApiClientGenerator < Base include MyApiClient::GeneratorHelper source_root File.expand_path('templates', __dir__) argument :requests, type: :array, default: %w[get:path/to/resource post:path/to/resource], banner: '{method}:{path} {method}:{path}' class_option :endpoint, type: :string, default: 'https://example.com', banner: 'https://example.com', desc: 'Common part of the target API endpoint' class_option :api_client_specs, type: :boolean, default: true def generate_api_client_spec return unless options[:api_client_specs] file_path = File.join('spec/api_clients', "#{route_url.singularize}_api_client_spec.rb") template 'api_client_spec.rb.erb', file_path end end end end
Version data entries
13 entries across 13 versions & 1 rubygems