ole-qa-framework 3.6.4 → 3.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +7 -0
- data/data/borrower_types.yml +14 -0
- data/lib/data_factory/patron_factory.rb +21 -14
- data/lib/ole_qa_framework/VERSION.rb +1 -1
- data/spec/data_factory/patron_factory_spec.rb +18 -9
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDhjYjljNmVlN2ViMjAzYTIzNmRhMjU0ODczNTQwNjdkNzc4NDlmOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZThlMmJlZGRiMjI5NTE5ZjY2MTQ4ZGU2ZmQxYjNlNDExNmM5MTIwMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTgwMmM1ZmJmYTc1YjNlMzU4Y2MxNGE2N2FhOWM0MTRjN2Y1NjMxNDJhN2Fh
|
10
|
+
Y2VjOTU4MTM0MzIyOTZiNjkxM2NkNmQ5YjhiNmZmMzIzNzdhZjU2NjBhODJh
|
11
|
+
ODM0OTZkMjJkOTc3OWFhZGU0YTIzOGVlNGViYzBmYzRkNWZmN2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWFkN2EwNzYzY2Q1NjBmYzU1Y2U1OGRlNTA4NzVjZWQwMjk5NTc2MzcwY2Fh
|
14
|
+
OTQ0MWNhMTIzYWIyNjFlNGM2YWI0NGNhMWY0MDc3MTQxMTcxZDgxYzQ0MWI1
|
15
|
+
MzdhN2I0MTA3NTM2ODJkNDJmNmJhY2M4MzMwMmIxNWU0NDA0MDA=
|
data/CHANGELOG.md
CHANGED
@@ -15,31 +15,38 @@
|
|
15
15
|
module OLE_QA::Framework
|
16
16
|
# Return usable patron records from source files in ole-qa-framework/data/patron.yml
|
17
17
|
class Patron_Factory
|
18
|
-
|
19
|
-
@patron_matrix
|
20
|
-
|
18
|
+
|
19
|
+
@patron_matrix = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/patron.yml"))
|
20
|
+
@states = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/states.yml"))
|
21
|
+
@borrower_types = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/borrower_types.yml"))
|
21
22
|
|
22
23
|
class << self
|
23
24
|
# An array containing a collection of valid OLE patron records.
|
24
25
|
attr_reader :patron_matrix
|
25
26
|
|
27
|
+
# An array containing a collection of valid states to use for patron records.
|
28
|
+
attr_reader :states
|
29
|
+
|
30
|
+
# An array containing a collection of valid borrower types to use for patron records.
|
31
|
+
attr_reader :borrower_types
|
32
|
+
|
26
33
|
# Return a random patron record.
|
27
34
|
def select_patron
|
28
35
|
@patron_matrix.sample
|
29
36
|
end
|
30
37
|
|
31
38
|
def new_patron
|
32
|
-
patron
|
33
|
-
|
34
|
-
patron[:
|
35
|
-
patron[:
|
36
|
-
patron[:
|
37
|
-
patron[:address]
|
38
|
-
patron[:city]
|
39
|
-
patron[:state]
|
40
|
-
patron[:postal_code]
|
41
|
-
patron[:phone]
|
42
|
-
patron[:email]
|
39
|
+
patron = Hash.new
|
40
|
+
patron[:first] = name_builder(sampler(2..8))
|
41
|
+
patron[:last] = name_builder(sampler(6..8))
|
42
|
+
patron[:barcode] = num_str(sampler(6..12))
|
43
|
+
patron[:borrower_type] = @borrower_types.sample
|
44
|
+
patron[:address] = num_str(sampler(3..5)) + ' ' + name_builder(sampler(4..8)) + ' ' + name_builder(2)
|
45
|
+
patron[:city] = name_builder(sampler(4..12))
|
46
|
+
patron[:state] = @states.sample.upcase
|
47
|
+
patron[:postal_code] = num_str(5)
|
48
|
+
patron[:phone] = num_str(3) + '-' + num_str(3) + '-' + num_str(4)
|
49
|
+
patron[:email] = patron[:first] + patron[:last] + '@' + str(sampler(4..8)) + '.' + str(3)
|
43
50
|
patron
|
44
51
|
end
|
45
52
|
|
@@ -27,17 +27,26 @@ describe 'The Patron Factory' do
|
|
27
27
|
patron.should include(:id, :first, :last, :barcode)
|
28
28
|
end
|
29
29
|
|
30
|
+
it 'should have a borrower type array' do
|
31
|
+
OLE_QA::Framework::Patron_Factory.borrower_types.should be_an(Array)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should have a states array' do
|
35
|
+
OLE_QA::Framework::Patron_Factory.states.should be_an(Array)
|
36
|
+
end
|
37
|
+
|
30
38
|
it 'should return a new patron' do
|
31
39
|
patron = OLE_QA::Framework::Patron_Factory.new_patron
|
32
40
|
patron.should be_a(Hash)
|
33
|
-
patron[:first].should
|
34
|
-
patron[:last].should
|
35
|
-
patron[:barcode].should
|
36
|
-
patron[:
|
37
|
-
patron[:
|
38
|
-
patron[:
|
39
|
-
patron[:
|
40
|
-
patron[:
|
41
|
-
patron[:
|
41
|
+
patron[:first].should =~ /[A-Z]{1}[a-z]+/
|
42
|
+
patron[:last].should =~ /[A-Z]{1}[a-z]+/
|
43
|
+
patron[:barcode].should =~ /[0-9]+/
|
44
|
+
patron[:borrower_type].should =~ /[A-Z,a-z]+/
|
45
|
+
patron[:address].should =~ /[0-9]+\s[A-Z]{1}[a-z]+\s[A-Z]{1}[a-z]{1}/
|
46
|
+
patron[:city].should =~ /[A-Z]{1}[a-z]+/
|
47
|
+
patron[:state].should =~ /[A-Z]+/ || /[A-Z]+\s[A-Z]+/
|
48
|
+
patron[:postal_code].should =~ /[0-9]{5}/
|
49
|
+
patron[:phone].should =~ /[0-9]{3}\-[0-9]{3}\-[0-9]{4}/
|
50
|
+
patron[:email].should =~ /[A-Z,a-z]+\@[a-z]+\.[a-z]{3}/
|
42
51
|
end
|
43
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ole-qa-framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jain Waldrip
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- Rakefile.rb
|
111
111
|
- data/accounts.yml
|
112
|
+
- data/borrower_types.yml
|
112
113
|
- data/objects.yml
|
113
114
|
- data/patron.yml
|
114
115
|
- data/states.yml
|