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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWM0Yzk1MWJiZjZjNTJmN2I1Zjk1ZmI0ZDVmMTE3YzdmN2ZiYzNhMg==
4
+ MDhjYjljNmVlN2ViMjAzYTIzNmRhMjU0ODczNTQwNjdkNzc4NDlmOA==
5
5
  data.tar.gz: !binary |-
6
- MzBlN2JhMWM3MDNkYzYxNGM5YWU4OWFhNTNkNzQ2N2JmMTE4NmI1Zg==
6
+ ZThlMmJlZGRiMjI5NTE5ZjY2MTQ4ZGU2ZmQxYjNlNDExNmM5MTIwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjAxM2Y5ZWRhNTY3YTczNzE4MzUxZDQ2YTg4YTg2YWNjOGY4MWJiZWQwYTU2
10
- Yzc3MGFiYWJiMTY5YzBiNzFmMzI0ZjNjYjU1YzViYzE0YjJiYmRiN2NhZGM5
11
- NDE5OWI0NjUzZjE4ZTNkZTZjYTIwYTRjMmIyODdlMzFmMmNiZDA=
9
+ YTgwMmM1ZmJmYTc1YjNlMzU4Y2MxNGE2N2FhOWM0MTRjN2Y1NjMxNDJhN2Fh
10
+ Y2VjOTU4MTM0MzIyOTZiNjkxM2NkNmQ5YjhiNmZmMzIzNzdhZjU2NjBhODJh
11
+ ODM0OTZkMjJkOTc3OWFhZGU0YTIzOGVlNGViYzBmYzRkNWZmN2E=
12
12
  data.tar.gz: !binary |-
13
- ZDJmYzU3NTI3YTQwZDAxMGQxNjk3MjUwYmZjNjBkNTZkZjhiNTVkZTJhN2Y0
14
- ZmY3Y2IzNzQxNzIwZTJmYzlkYjJhN2IwNTJlNjJiMGI3MTI5ODE1ZDVlMGQ2
15
- MTE2YjcyMTM1NWViNWViMDg1ZjY2N2FiODM0NGI5MTg2YTQ2NDY=
13
+ ZWFkN2EwNzYzY2Q1NjBmYzU1Y2U1OGRlNTA4NzVjZWQwMjk5NTc2MzcwY2Fh
14
+ OTQ0MWNhMTIzYWIyNjFlNGM2YWI0NGNhMWY0MDc3MTQxMTcxZDgxYzQ0MWI1
15
+ MzdhN2I0MTA3NTM2ODJkNDJmNmJhY2M4MzMwMmIxNWU0NDA0MDA=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### v3.6.5 - 2013/12/12
2
+
3
+ * Patron Factory
4
+ * Add :borrower_type to new patron
5
+ * Add .borrower_types reader attribute
6
+ * Add .states reader attribute
7
+
1
8
  ### v3.6.4 - 2013/12/12
2
9
 
3
10
  * Patron
@@ -0,0 +1,14 @@
1
+ #
2
+ # Patron Borrower Types harvested from OLE Test Environment at:
3
+ # http://tst.ole.kuali.org/
4
+ #
5
+ ---
6
+ - AffVisRecip
7
+ - Alumni
8
+ - Faculty
9
+ - FacultyRetired
10
+ - Graduate
11
+ - Guest
12
+ - Researcher
13
+ - Staff
14
+ - UnderGrad
@@ -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
- patron_file = File.open("#{OLE_QA::Framework.data_dir}/patron.yml",'r')
19
- @patron_matrix = YAML.load(patron_file)
20
- patron_file.close
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 = Hash.new
33
- states = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/states.yml"))
34
- patron[:first] = name_builder(sampler(2..8))
35
- patron[:last] = name_builder(sampler(6..8))
36
- patron[:barcode] = num_str(sampler(6..12))
37
- patron[:address] = num_str(sampler(3..5)) + ' ' + name_builder(sampler(4..8)) + ' ' + name_builder(2)
38
- patron[:city] = name_builder(sampler(4..12))
39
- patron[:state] = states.sample.upcase
40
- patron[:postal_code] = num_str(5)
41
- patron[:phone] = num_str(3) + '-' + num_str(3) + '-' + num_str(4)
42
- patron[:email] = patron[:first] + patron[:last] + '@' + str(sampler(4..8)) + '.' + str(3)
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
 
@@ -15,6 +15,6 @@
15
15
  module OLE_QA
16
16
  module Framework
17
17
  # The version number for this project.
18
- VERSION = '3.6.4'
18
+ VERSION = '3.6.5'
19
19
  end
20
20
  end
@@ -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 =~ /[A-Z]{1}[a-z]+/
34
- patron[:last].should =~ /[A-Z]{1}[a-z]+/
35
- patron[:barcode].should =~ /[0-9]+/
36
- patron[:address].should =~ /[0-9]+\s[A-Z]{1}[a-z]+\s[A-Z]{1}[a-z]{1}/
37
- patron[:city].should =~ /[A-Z]{1}[a-z]+/
38
- patron[:state].should =~ /[A-Z]+/ || /[A-Z]+\s[A-Z]+/
39
- patron[:postal_code].should =~ /[0-9]{5}/
40
- patron[:phone].should =~ /[0-9]{3}\-[0-9]{3}\-[0-9]{4}/
41
- patron[:email].should =~ /[A-Z,a-z]+\@[a-z]+\.[a-z]{3}/
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
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