Sha256: 185a9e4325aa79728f97f4313a094c1929d4f76e6113bb82a8683661cca94f24

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

module Rspec
  module Generators
    class TransactionGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('templates', __dir__)

      def create_transaction_spec
        template 'transaction_spec.rb.erb', "spec/models/#{module_path}/#{file_name}.rb"
      end

      def file_name
        "#{class_name.underscore}_spec"
      end

      def qualified_class_name
        "#{module_name}::#{class_name}"
      end

      def class_name
        "#{name.to_s.classify.chomp('Transaction')}Transaction"
      end

      def module_name
        module_path.classify
      end

      def module_path
        'ledger'
      end

      def factory_name
        class_name.underscore
      end

      hook_for :fixture_replacement
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generalis-0.1.0 lib/generators/rspec/transaction_generator.rb