Sha256: 21de979c93ea2b45eb4fad95e9be8e0b908a3f97bd57217831db9cff1423ffcc
Contents?: true
Size: 1.32 KB
Versions: 26
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true module LeapSalesforce # A test user used to execute tests class User # @return [String] Name to identify user by attr_accessor :key # @return [String] Username of User interpreted by ERB (in email address format). Use ERB to define users that can vary # according to environment attr_writer :username # @return [String] Long form description of user. Could be used to reference them in a Cucumber test attr_accessor :description # @param [String, Symbol] key Key used to identify a test user # @param [String] username Name used to login with user. In email address format. def initialize(key, username, description: nil) self.key = key self.username = username self.description = description end # @return [String] Email address of User def username ERB.new(@username).result(binding) end # @param [Symbol, String] field Field to check # @param [Object, Regex] criteria Either object with same value or regex that has a match anywhere in string # @return [Boolean] Whether key and criteria match current user def match?(field, criteria) actual_value = send(field.to_s) case criteria when Regexp then !actual_value[criteria].nil? else actual_value == criteria end end end end
Version data entries
26 entries across 26 versions & 1 rubygems