Sha256: 4b7cc0be25c76c23f6fc3ac5574adb49f194d49fba9589b7cce92027f6b40a23

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module Generalis
  module RSpec
    module FormatHelper
      # @param entry [Generalis::Entry]
      # @return [String]
      def format_entry(entry)
        "\t#{format_money(entry.amount)} to #{format_account(entry.account)}"
      end

      # @param account [Generalis::Account]
      # @return [String]
      def format_account(account)
        text  = "#{account.class}[:#{account.name}]"
        text += " (Owner: #{account.owner.class} #{account.owner.id})" if account.owner

        text
      end

      # @param money [Money]
      # @return [String]
      def format_money(money)
        "#{money.format} (#{money.currency})"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generalis-0.1.0 lib/rspec/helpers/format_helper.rb