Sha256: f0a6142d5d020148bb4677887b3e45df361110c7163b5d04ddce7f6afb287236

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

module Generalis
  module RSpec
    module ResolveAccountHelper
      # @param location [Symbol, String, Generalis::Account]
      # @param owner [ActiveRecord::Base, nil]
      # @return [Generalis::Account]
      def resolve_account(locator, owner:)
        case locator
        when Generalis::Account
          locator
        when String, Symbol
          Generalis::Account.lookup(locator, owner: owner)
        else
          raise ArgumentError, "Expected a Generalis::Account, String, or Symbol, got #{account.inspect}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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