ole-qa-framework 3.14.1 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/LICENSE.md +1 -1
  4. data/README.md +93 -1
  5. data/Rakefile.rb +38 -12
  6. data/config/options.yml +11 -0
  7. data/data/circulation.yml +10 -0
  8. data/data/country.yml +3 -0
  9. data/lib/common/common_object.rb +1 -1
  10. data/lib/common/data_object.rb +1 -2
  11. data/lib/common/line_object.rb +1 -1
  12. data/lib/common/page.rb +27 -3
  13. data/lib/common/subline_object.rb +1 -1
  14. data/lib/data_factory/account_factory.rb +3 -3
  15. data/lib/data_factory/bib_factory.rb +14 -4
  16. data/lib/data_factory/metadata_factory.rb +4 -3
  17. data/lib/data_factory/patron_factory.rb +10 -5
  18. data/lib/data_factory/string_factory.rb +2 -2
  19. data/lib/docstore/common/results.rb +1 -1
  20. data/lib/docstore/pages/marc_results.rb +1 -1
  21. data/lib/docstore/pages/search.rb +1 -1
  22. data/lib/module/factory_helpers.rb +1 -1
  23. data/lib/module/qa_helpers.rb +1 -1
  24. data/lib/ole-qa-framework.rb +17 -16
  25. data/lib/ole_qa_framework/COMPATIBILITY.rb +1 -1
  26. data/lib/ole_qa_framework/VERSION.rb +2 -2
  27. data/lib/olefs/common/e_doc.rb +1 -1
  28. data/lib/olefs/common/lookup.rb +1 -1
  29. data/lib/olefs/common/purap_document.rb +1 -1
  30. data/lib/olefs/objects/invoice_current_item.rb +1 -1
  31. data/lib/olefs/objects/invoice_line.rb +1 -1
  32. data/lib/olefs/objects/line_item.rb +1 -1
  33. data/lib/olefs/objects/receiving_line.rb +1 -1
  34. data/lib/olefs/pages/building_lookup.rb +1 -1
  35. data/lib/olefs/pages/invoice.rb +1 -1
  36. data/lib/olefs/pages/load_report.rb +1 -1
  37. data/lib/olefs/pages/load_summary_lookup.rb +1 -1
  38. data/lib/olefs/pages/main_menu.rb +1 -1
  39. data/lib/olefs/pages/payment_request.rb +1 -1
  40. data/lib/olefs/pages/purchase_order.rb +1 -1
  41. data/lib/olefs/pages/receiving_document.rb +1 -1
  42. data/lib/olefs/pages/requisition.rb +1 -1
  43. data/lib/olefs/pages/vendor_lookup.rb +1 -1
  44. data/lib/olefs/subobjects/accounting_line.rb +1 -1
  45. data/lib/olefs/subobjects/copies_line.rb +1 -1
  46. data/lib/olefs/subobjects/exception_notes_line.rb +1 -1
  47. data/lib/olefs/subobjects/invoice_line_item.rb +1 -1
  48. data/lib/olefs/subobjects/notes_line.rb +1 -1
  49. data/lib/olefs/subobjects/processing_line.rb +1 -1
  50. data/lib/olefs/subobjects/receipt_notes_line.rb +1 -1
  51. data/lib/olels/common/batch_profile.rb +1 -1
  52. data/lib/olels/common/e_doc.rb +1 -1
  53. data/lib/olels/common/editor.rb +1 -1
  54. data/lib/olels/common/lookup.rb +1 -1
  55. data/lib/olels/objects/access_info_line.rb +1 -1
  56. data/lib/olels/objects/batch_data_mapping_line.rb +1 -1
  57. data/lib/olels/objects/batch_delete_field_line.rb +1 -1
  58. data/lib/olels/objects/batch_rename_field_line.rb +1 -1
  59. data/lib/olels/objects/control_006_line.rb +1 -1
  60. data/lib/olels/objects/control_007_line.rb +1 -1
  61. data/lib/olels/objects/data_line.rb +1 -1
  62. data/lib/olels/objects/editor_note.rb +1 -1
  63. data/lib/olels/objects/export_filter_line.rb +1 -1
  64. data/lib/olels/objects/holdings_note.rb +1 -1
  65. data/lib/olels/objects/import_defaults_line.rb +1 -1
  66. data/lib/olels/objects/import_match_line.rb +1 -1
  67. data/lib/olels/objects/import_pf_line.rb +1 -1
  68. data/lib/olels/objects/item_note.rb +1 -1
  69. data/lib/olels/objects/ownership_extent_line.rb +1 -1
  70. data/lib/olels/objects/patron_address_line.rb +1 -1
  71. data/lib/olels/objects/patron_email_line.rb +1 -1
  72. data/lib/olels/objects/patron_phone_line.rb +1 -1
  73. data/lib/olels/objects/workbench_line.rb +1 -1
  74. data/lib/olels/pages/batch_export_profile.rb +1 -1
  75. data/lib/olels/pages/batch_import_profile.rb +1 -1
  76. data/lib/olels/pages/batch_job_details.rb +1 -1
  77. data/lib/olels/pages/batch_job_report.rb +1 -1
  78. data/lib/olels/pages/batch_process.rb +1 -1
  79. data/lib/olels/pages/batch_profile_lookup.rb +1 -1
  80. data/lib/olels/pages/batch_type_lookup.rb +1 -1
  81. data/lib/olels/pages/bib_editor.rb +1 -1
  82. data/lib/olels/pages/describe_workbench.rb +1 -1
  83. data/lib/olels/pages/instance_editor.rb +1 -1
  84. data/lib/olels/pages/item_editor.rb +1 -1
  85. data/lib/olels/pages/item_lookup.rb +1 -1
  86. data/lib/olels/pages/loan.rb +1 -1
  87. data/lib/olels/pages/location.rb +1 -1
  88. data/lib/olels/pages/location_level_lookup.rb +1 -1
  89. data/lib/olels/pages/location_lookup.rb +1 -1
  90. data/lib/olels/pages/main_menu.rb +1 -1
  91. data/lib/olels/pages/old_describe_workbench.rb +1 -1
  92. data/lib/olels/pages/patron.rb +1 -1
  93. data/lib/olels/pages/patron_lookup.rb +1 -1
  94. data/lib/olels/pages/renewal.rb +1 -1
  95. data/lib/olels/pages/request.rb +1 -1
  96. data/lib/olels/pages/request_lookup.rb +1 -1
  97. data/lib/olels/pages/return.rb +1 -1
  98. data/lib/olels/pages/staff_upload.rb +1 -1
  99. data/lib/olels/subobjects/ownership_note.rb +1 -1
  100. data/spec/common/browser_spec.rb +2 -2
  101. data/spec/common/data_object_spec.rb +2 -2
  102. data/spec/common/line_object_spec.rb +2 -2
  103. data/spec/common/page_spec.rb +2 -2
  104. data/spec/common/session_spec.rb +62 -0
  105. data/spec/common/subline_object_spec.rb +2 -2
  106. data/spec/data_factory/account_factory_spec.rb +1 -1
  107. data/spec/data_factory/bib_factory_spec.rb +17 -1
  108. data/spec/data_factory/patron_factory_spec.rb +6 -1
  109. data/spec/data_factory/string_factory_spec.rb +1 -1
  110. data/spec/modules/qa_helpers_spec.rb +2 -2
  111. data/spec/spec_helper.rb +1 -1
  112. metadata +7 -9
  113. data/lib/config/alt/dev_env.yml +0 -8
  114. data/lib/config/alt/test_env.yml +0 -8
  115. data/lib/config/default_options.yml +0 -8
  116. data/lib/module/qa_data_helpers.rb +0 -17
  117. data/lib/module/qa_page_helpers.rb +0 -41
  118. data/spec/modules/qa_page_helpers_spec.rb +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fda8afd432cda6d8ec31f2da530e71da8e1ef1e5
4
- data.tar.gz: b98b3bec9e9ce315d3cd018fac14489a03f98505
3
+ metadata.gz: 725c44e11f55eccafd6ff4c7809e2b73b8e67eb4
4
+ data.tar.gz: 03eb2fb83bfd8cab61508524ca0ed69caffd0e61
5
5
  SHA512:
6
- metadata.gz: 8a82c0e74359a8b1059e9fef39a72a568101b7d69f1fe9b64a791a96fa9ee7b121757847d999b03fb00f73e9d870b00f62710990c4a4d752b3013c4958309afd
7
- data.tar.gz: 4a6e391e174c7edce8956702243ca2b486510f703bf640730e58fd3106e2104e2b395294b04d2c393f11842ebe045e7d88951097f9d4c90971f1be8725a60c73
6
+ metadata.gz: e30b829f8bef67fc32d46346b0a0a4644cb59422825cbeb5479d7082a8e3d1106ac9cb3a93bfd596071988e03bd9167292f9b17a7a1dfd1d0372bf7fcfda469d
7
+ data.tar.gz: e36db42fcfbbf8ebb55adf695acc3c51ce0ea3ae17978bbfb73c9ed8144b506a864a5af0b866479af4ebe9544dc3afc2fb76ef7f39d5de3f88b765f1bf8cdb02
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ### v3.15.0 - 2014/06/18
2
+
3
+ * Update Framework module & Session class
4
+ * Add session spec
5
+ * Move lib/config/default_options.yml to config/options.yml
6
+ * Update Rakefile
7
+ * Remove select_config task
8
+ * Add show_config task
9
+ * Add configurator task
10
+ * Update Readme
11
+ * Add instructions for show_config & configurator tasks
12
+ * Clean up modules
13
+ * Move page helpers to lib/common/page.rb
14
+ * Remove lib/module/qa_page_helpers.rb
15
+ * Remove redundant page helpers spec
16
+ * Remove lib/module/qa_data_helpers.rb
17
+ * Clean up Data Factories
18
+ * Change classes to modules
19
+ * Add country attribute to patron factory
20
+ * Add country data file to data/
21
+ * Update Copyright info
22
+ * Clean up specs
23
+ * Add @ole.nil? check to specs using live sessions
24
+ * Add circulation info selector to Bib Factory
25
+ * OLE_QA::Framework::Bib_Factory.circulation_info will return a hash containing
26
+ a circulation desk code, circulation desk name, and an array of locations which
27
+ are mapped to that circulation desk.
28
+ * Added examples to spec/data_factory/bib_factory_spec.rb
29
+ * Add institutional data configuration section to README.md
30
+
1
31
  ### v3.14.1 - 2014/05/19
2
32
 
3
33
  * Add Conributions document
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- ### Copyright 2005-2013 The Kuali Foundation
1
+ ### Copyright 2005-2014 The Kuali Foundation
2
2
  - - -
3
3
 
4
4
  Licensed under the Educational Community License, Version 2.0 (the "License");
data/README.md CHANGED
@@ -8,4 +8,96 @@ http://www.kuali.org/ole
8
8
  - - -
9
9
  This is a testing framework for the Kuali Open Library environment. It
10
10
  is be used to define OLE pages and screen elements for OLE regression
11
- testing scripts and the OLE Smoketest application.
11
+ testing scripts and the OLE Smoketest application.
12
+
13
+ ### Configuration
14
+
15
+ Options can be set in the file config/options.yml. Here is a list of the
16
+ options hash keys and their meanings:
17
+
18
+ - :url:
19
+ - The URL of the main OLE installation you will be testing.
20
+ - :docstore_url:
21
+ - The URL of the OLE Document Store installation.
22
+ - :headless?:
23
+ - If set to true, the testing session will be run headlessly
24
+ in an XVFB session handled by the Headless gem.
25
+ - :implicit_wait:
26
+ - Used to set Selenium Webdriver's default wait period.
27
+ - :explicit_wait:
28
+ - Used to set the Watir Webdriver default wait period.
29
+ - :doc_wait:
30
+ - Used to set the maximum timeout for an OLE eDocument
31
+ to finish routing to the next step in its workflow.
32
+ - :browser:
33
+ - Pass an active instance of Watir Webdriver if you want to start
34
+ an OLE Framework session with an already-running browser.
35
+
36
+ These options can be set manually, or using the Rake configurator task.
37
+ Use the Rake show_config task to see the current options settings at any time.
38
+
39
+ ### Instituational Data
40
+
41
+ Institutional data is defined in the YAML files in the data/ directory. The
42
+ OLE QA Framework can be adapted to use different institutional data first by
43
+ editing the YAML data files in data/, and optionally altering the default values
44
+ of a few data factories and their respective RSpec tests in the spec/ directory.
45
+
46
+ #### YAML Data Files
47
+
48
+ The data/ directory contains the following YAML data files:
49
+
50
+ - accounts.yml
51
+ - OLE account numbers, organized into a hash containing arrays of
52
+ account numbers organized by chart code.
53
+ - borrower_types.yml
54
+ - Borrower types used for patron and circulation information,
55
+ organized into an array.
56
+ - circulation.yml
57
+ - Circulation desks and the locations which they serve, organized
58
+ into an array containing a hash for each desk, which itself contains
59
+ an array of locations served by that desk.
60
+ - country.yml
61
+ - A string containing the country name to be used for patron information,
62
+ as it appears in the OLE application itself.
63
+ - objects.yml
64
+ - Object code values for accounting, organized into a hash containing
65
+ arrays of object codes organized by chart code.
66
+ - patron.yml
67
+ - An array of hashes containing patron information drawn from the OLE
68
+ demo data, with keys for ID, first and last name, and barcode.
69
+ - states.yml
70
+ - An array of states used for OLE patron information, as they appear
71
+ in the OLE application itself.
72
+
73
+ #### Default Data Values in Classes
74
+
75
+ The following classes in the lib/data_factory/ directory contain default
76
+ selections which may need to be changed for optimal functionality:
77
+
78
+ - account_factory.rb
79
+ - Methods for selecting account and object codes default to the :BL
80
+ chart selector.
81
+ - string_factory.rb
82
+ - Prices are formatted to two decimal places by default. Non-US prices
83
+ may need commas or other separator values.
84
+ - Phone numbers are in US NNN-NNN-NNNN format.
85
+ - patron_factory.rb
86
+ - Phone numbers are in US NNN-NNN-NNNN format.
87
+
88
+ #### Default Data Values in Specs
89
+
90
+ The following specs in spec/data_factory contain default selections which
91
+ may need to be changed for optimal functionality:
92
+
93
+ - bib_factory_spec.rb
94
+ - Tests for selecting a circulation desk use the 'BL_EDUC' circulation
95
+ desk, taken from the OLE demo data.
96
+ - string_factory_spec.rb
97
+ - Tests for phone numbers default to the US NNN-NNN-NNNN phone number
98
+ format.
99
+ - patron_factory_spec.rb
100
+ - Tests for phone numbers default to the US NNN-NNN-NNNN phone number
101
+ format.
102
+
103
+
data/Rakefile.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ require 'rspec/core/rake_task'
20
20
  require 'bundler/gem_tasks'
21
21
  require 'fileutils'
22
22
  require 'lib/ole_qa_framework/COMPATIBILITY.rb'
23
+ require 'yaml'
23
24
 
24
25
  desc "Print the current version number."
25
26
  task :version do
@@ -31,16 +32,41 @@ task :works_with do
31
32
  puts OLE_QA::Framework::OLE_VERSION
32
33
  end
33
34
 
34
- desc "Select a config file from lib/config/alt."
35
- task :select_config do
36
- puts 'Enter filename: '
37
- target_file = STDIN.gets.chomp
38
- target_file += '.yml' unless target_file =~ /\.yml$/
39
- file_path = "#{loaddir}/lib/config/"
40
- if File.exists?(file_path + 'alt/' + target_file)
41
- FileUtils.cp "#{file_path}alt/#{target_file}", "#{file_path}default_options.yml"
42
- puts "Successfully copied #{file_path}alt/#{target_file}."
43
- else
44
- puts "File not found: #{file_path}alt/#{target_file}"
35
+ desc 'Interactively configure config/options.yml'
36
+ task :configurator do
37
+ config_file = File.open('config/options.yml','r')
38
+ options = YAML.load(config_file)
39
+ config_file.close
40
+
41
+ options.each do |k,v|
42
+ puts "#{k.to_s.ljust(20)}: #{v}"
43
+ puts "... (k)eep or (c)hange? [k|c]"
44
+ ans = STDIN.gets.chomp
45
+ if ans =~ /[Cc]/
46
+ puts "Enter new value:"
47
+ new_val = STDIN.gets.chomp
48
+ if v.is_a?(TrueClass) || v.is_a?(FalseClass)
49
+ new_val.match(/^[Tt]/) ? new_val = true : new_val = false
50
+ else
51
+ new_val = new_val.to_i unless new_val.to_i == 0
52
+ end
53
+ options[k] = new_val
54
+ puts "#{k.to_s.ljust(20)} updated to: #{new_val}"
55
+ end
45
56
  end
57
+
58
+ config_file = File.open('config/options.yml','w')
59
+ YAML.dump(options,config_file)
60
+ config_file.close
61
+
46
62
  end
63
+
64
+ desc 'Show current options in config/options.yml'
65
+ task :show_config do
66
+ config_file = File.open('config/options.yml','r')
67
+ options = YAML.load(config_file)
68
+ config_file.close
69
+ options.each do |k,v|
70
+ puts "#{k.to_s.ljust(20)}: #{v}"
71
+ end
72
+ end
@@ -0,0 +1,11 @@
1
+ # Default options for an OLE QA Framework session.
2
+ # (Parsed at session instantiation. See
3
+ # OLE_QA::Framework::Session#new for
4
+ # more information.)
5
+ ---
6
+ :url: http://tst.ole.kuali.org/
7
+ :docstore_url: http://tst.docstore.ole.kuali.org/
8
+ :headless?: true
9
+ :implicit_wait: 0
10
+ :explicit_wait: 30
11
+ :doc_wait: 45
@@ -0,0 +1,10 @@
1
+ #
2
+ # Circulation sample data culled from the Kuali OLE Development Environment at:
3
+ # http://dev.ole.kuali.org/
4
+ #
5
+ ---
6
+ - :code: BL_EDUC
7
+ :name: BL Education
8
+ :locations:
9
+ - B-EDUC/BED-TEACHMAT
10
+ - B-EDUC/BED-STACKS
data/data/country.yml ADDED
@@ -0,0 +1,3 @@
1
+ # Set the default country name to be returned by data factories.
2
+ ---
3
+ United States
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -16,6 +16,5 @@ module OLE_QA::Framework
16
16
 
17
17
  # An object in OLE which contains screen elements but is not itself a screen element.
18
18
  class Data_Object < Common_Object
19
- include OLE_QA::Framework::Data_Helpers
20
19
  end
21
20
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
data/lib/common/page.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -29,8 +29,6 @@ module OLE_QA::Framework
29
29
  # An array containing the elements (Symbol) to wait on before the page is considered loaded.
30
30
  attr_reader :wait_on
31
31
 
32
- include OLE_QA::Framework::Page_Helpers
33
-
34
32
  # @param ole_session [Object] The OLE_QA::Framework::Session instance in which the page should load.
35
33
  # @param url [String] The URL (if any) used to open the page. (Set to "" if unused.)
36
34
  # @param lookup_url [String] The URL (if any) by which a document represented by the page can be opened.
@@ -99,6 +97,31 @@ module OLE_QA::Framework
99
97
  false
100
98
  end
101
99
 
100
+ # Set a line object definition on a page object.
101
+ # - A line object created with this method becomes an accessor attribute
102
+ # associated with an instance variable on the page or data object on
103
+ # which it is created.
104
+ #
105
+ # @param name [Symbol] The name the new line object will have on the object.
106
+ # (This will be an instance variable, so it cannot contain spaces.)
107
+ # @param klas [Class] The class to instantiate for the new line object.
108
+ # (An error will be returned if the class given is not defined.)
109
+ # @param force [Boolean] If set to true, this method can be used to override an existing line object definition.
110
+ #
111
+ # @raise StandardError if a parameter is of an incorrect type.
112
+ # @raise StandardError if an instance method already exists for a line object with the same name.
113
+ # (Suppress with force = true.)
114
+ #
115
+ def set_line(name, klas, force = false)
116
+ raise StandardError, "Name must be a symbol. Given: #{name} (#{name.class})" unless name.instance_of?(Symbol)
117
+ raise StandardError, "Klas must be a class. Given: #{klas} (#{klas.class})" unless klas.instance_of?(Class)
118
+ raise StandardError, "Line object is already defined. (Use the 'force = true' option to suppress this error.)" if @lines.include?(name) && ! force
119
+ instance_variable_set("@#{name}", klas.new(@ole, 1))
120
+ make_reader(name) unless force
121
+ @lines << name unless force
122
+ end
123
+ alias_method(:line, :set_line)
124
+
102
125
  # Set screen elements common to most or all pages across the OLE interface.
103
126
  def set_elements
104
127
  # These elements exist outside of any frame, so @browser is used to force
@@ -121,5 +144,6 @@ module OLE_QA::Framework
121
144
  # @return [Boolean] Whether the logout process succeeded.
122
145
  function(:logout) { logout_button.click ; login_confirmation.present? ? false : true}
123
146
  end
147
+
124
148
  end
125
149
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
15
15
  module OLE_QA::Framework
16
16
 
17
17
  # Generate usable accounting strings from source files in ole-qa-framework/data/
18
- class Account_Factory
18
+ module Account_Factory
19
19
 
20
20
  account_file = File.open("#{OLE_QA::Framework.data_dir}/accounts.yml",'r')
21
21
  @account_matrix = YAML.load(account_file)
@@ -49,4 +49,4 @@ module OLE_QA::Framework
49
49
 
50
50
  end
51
51
  end
52
- end
52
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -13,8 +13,8 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module OLE_QA::Framework
16
- # Manufacture strings for bibliographic record testing
17
- class Bib_Factory
16
+ # Manufacture strings for bibliographic, instance, and item record testing
17
+ module Bib_Factory
18
18
  class << self
19
19
 
20
20
  include OLE_QA::Framework::Factory_Helpers
@@ -60,6 +60,16 @@ module OLE_QA::Framework
60
60
  str << name_builder(last_len.to_i)
61
61
  end
62
62
  end
63
+
64
+ # Return a hash containing circulation desk and location information.
65
+ # @note Pass a circulation desk code defined in data/circulation.yml to return
66
+ # info on a specific circulation desk.
67
+ def circulation_info(desk_code = '')
68
+ circ_ary = YAML.load_file(OLE_QA::Framework.data_dir + '/circulation.yml')
69
+ hsh_out = desk_code.empty? ? circ_ary.sample : circ_ary.find {|circ| circ[:code] == desk_code}
70
+ raise OLE_QA::Framework::Error,"No circulation desk found.#{ ' Given: ' + desk_code unless desk_code.empty?}" if hsh_out.nil?
71
+ return hsh_out
72
+ end
63
73
  end
64
74
  end
65
- end
75
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -13,8 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module OLE_QA::Framework
16
- # This class contains methods to generate assorted metadata.
17
- class Metadata_Factory
16
+ # This class contains methods to generate assorted metadata for the OLE application.
17
+ # {OLE_QA::Framework::Bib_Factory} should be used for creating bibliographic metadata.
18
+ module Metadata_Factory
18
19
  class << self
19
20
  include OLE_QA::Framework::Factory_Helpers
20
21
 
@@ -1,4 +1,4 @@
1
- # Copyright 2005-2013 The Kuali Foundation
1
+ # Copyright 2005-2014 The Kuali Foundation
2
2
  #
3
3
  # Licensed under the Educational Community License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -14,12 +14,13 @@
14
14
 
15
15
  module OLE_QA::Framework
16
16
  # Return usable patron records from source files in ole-qa-framework/data/patron.yml
17
- class Patron_Factory
17
+ module Patron_Factory
18
18
 
19
19
 
20
- @patron_matrix = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/patron.yml"))
21
- @states = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/states.yml"))
22
- @borrower_types = YAML.load(File.read("#{OLE_QA::Framework.data_dir}/borrower_types.yml"))
20
+ @patron_matrix = YAML.load_file("#{OLE_QA::Framework.data_dir}/patron.yml")
21
+ @states = YAML.load_file("#{OLE_QA::Framework.data_dir}/states.yml")
22
+ @borrower_types = YAML.load_file("#{OLE_QA::Framework.data_dir}/borrower_types.yml")
23
+ @country = YAML.load_file("#{OLE_QA::Framework.data_dir}/country.yml")
23
24
 
24
25
  class << self
25
26
 
@@ -35,6 +36,9 @@ module OLE_QA::Framework
35
36
  # An array containing a collection of valid borrower types to use for patron records.
36
37
  attr_reader :borrower_types
37
38
 
39
+ # A string containing the country name as it appears in the OLE application.
40
+ attr_reader :country
41
+
38
42
  # Return a random patron record.
39
43
  def select_patron
40
44
  @patron_matrix.sample
@@ -50,6 +54,7 @@ module OLE_QA::Framework
50
54
  patron[:city] = name_builder(sampler(4..12))
51
55
  patron[:state] = @states.sample.upcase
52
56
  patron[:postal_code] = num_str(5)
57
+ patron[:country] = @country
53
58
  patron[:phone] = num_str(3) + '-' + num_str(3) + '-' + num_str(4)
54
59
  patron[:email] = patron[:first] + patron[:last] + '@' + str(sampler(4..8)) + '.' + str(3)
55
60
  patron