Module: OLE_QA::Framework::Patron_Factory
- Extended by:
- Factory_Helpers
- Defined in:
- lib/data_factory/patron_factory.rb
Overview
Return usable patron records from source files in ole-qa-framework/data/patron.yml
Class Attribute Summary collapse
-
.borrower_types ⇒ Object
readonly
An array containing a collection of valid borrower types to use for patron records.
-
.country ⇒ Object
readonly
A string containing the country name as it appears in the OLE application.
-
.patron_matrix ⇒ Object
readonly
An array containing a collection of valid OLE patron records.
-
.states ⇒ Object
readonly
An array containing a collection of valid states to use for patron records.
Class Method Summary collapse
- .new_patron ⇒ Object
-
.select_patron ⇒ Object
Return a random patron record.
Class Attribute Details
.borrower_types ⇒ Object (readonly)
An array containing a collection of valid borrower types to use for patron records.
37 38 39 |
# File 'lib/data_factory/patron_factory.rb', line 37 def borrower_types @borrower_types end |
.country ⇒ Object (readonly)
A string containing the country name as it appears in the OLE application.
40 41 42 |
# File 'lib/data_factory/patron_factory.rb', line 40 def country @country end |
.patron_matrix ⇒ Object (readonly)
An array containing a collection of valid OLE patron records.
31 32 33 |
# File 'lib/data_factory/patron_factory.rb', line 31 def patron_matrix @patron_matrix end |
.states ⇒ Object (readonly)
An array containing a collection of valid states to use for patron records.
34 35 36 |
# File 'lib/data_factory/patron_factory.rb', line 34 def states @states end |
Class Method Details
.new_patron ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/data_factory/patron_factory.rb', line 47 def new_patron patron = Hash.new patron[:first] = name_builder(sampler(2..8)) patron[:last] = name_builder(sampler(6..8)) patron[:barcode] = num_str(sampler(6..12)) patron[:borrower_type] = @borrower_types.sample patron[:address] = num_str(sampler(3..5)) + ' ' + name_builder(sampler(4..8)) + ' ' + name_builder(2) patron[:city] = name_builder(sampler(4..12)) patron[:state] = @states.sample.upcase patron[:postal_code] = num_str(5) patron[:country] = @country patron[:phone] = num_str(3) + '-' + num_str(3) + '-' + num_str(4) patron[:email] = patron[:first] + patron[:last] + '@' + str(sampler(4..8)) + '.' + str(3) patron end |
.select_patron ⇒ Object
Return a random patron record.
43 44 45 |
# File 'lib/data_factory/patron_factory.rb', line 43 def select_patron @patron_matrix.sample end |