kuality-coeus 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +2 -2
  4. data/features/grants_gov/grants_gov_forms/code_and_form_mapping.feature +1 -1
  5. data/features/grants_gov/grants_gov_forms/s2s_questionnaire.feature +8 -12
  6. data/features/grants_gov/s2s_submission.feature +7 -4
  7. data/features/grants_gov/s2s_validation.feature +3 -3
  8. data/features/proposal_development/create_proposal.feature +2 -9
  9. data/features/proposal_development/key_personnel_validations.feature +1 -7
  10. data/features/proposal_development/proposal_permissions.feature +1 -28
  11. data/features/proposal_development/proposal_workflow.feature +1 -7
  12. data/features/roles/roles.feature +14 -0
  13. data/features/step_definitions/awards/create_award.rb +15 -0
  14. data/features/step_definitions/budget_versions/budget_versions.rb +8 -1
  15. data/features/step_definitions/grants_gov/s2s_submission.rb +2 -2
  16. data/features/step_definitions/groups.rb +13 -0
  17. data/features/step_definitions/maintenance.rb +7 -0
  18. data/features/step_definitions/proposal_development/budget_versions.rb +98 -0
  19. data/features/step_definitions/proposal_development/edit_proposal.rb +4 -0
  20. data/features/step_definitions/proposal_development/key_personnel_validations.rb +7 -7
  21. data/features/step_definitions/proposal_development/proposal_permissions.rb +20 -2
  22. data/features/step_definitions/proposal_logs/create_proposal_log.rb +13 -0
  23. data/features/step_definitions/protocol_development/irb_create_protocol.rb +28 -0
  24. data/features/step_definitions/roles.rb +17 -0
  25. data/features/step_definitions/users.rb +42 -7
  26. data/features/support/env.rb +16 -1
  27. data/kuality-coeus.gemspec +2 -2
  28. data/lib/kuality-coeus.rb +1 -0
  29. data/lib/kuality-coeus/data_objects/award/award.rb +13 -14
  30. data/lib/kuality-coeus/data_objects/award/award_transaction.rb +3 -1
  31. data/lib/kuality-coeus/data_objects/budget/budget_periods.rb +17 -3
  32. data/lib/kuality-coeus/data_objects/budget/budget_versions.rb +9 -12
  33. data/lib/kuality-coeus/data_objects/budget/cost_sharing.rb +56 -0
  34. data/lib/kuality-coeus/data_objects/budget/personnel.rb +3 -3
  35. data/lib/kuality-coeus/data_objects/budget/subaward_budget.rb +2 -2
  36. data/lib/kuality-coeus/data_objects/committee_document/committee_document.rb +2 -2
  37. data/lib/kuality-coeus/data_objects/committee_document/committee_members.rb +4 -2
  38. data/lib/kuality-coeus/data_objects/committee_document/committee_schedule.rb +3 -1
  39. data/lib/kuality-coeus/data_objects/committee_document/member_roles.rb +3 -1
  40. data/lib/kuality-coeus/data_objects/compliance_and_protocol/irb_protocol_development.rb +86 -0
  41. data/lib/kuality-coeus/data_objects/identity/group.rb +22 -8
  42. data/lib/kuality-coeus/{page_objects/identity/assignee.rb → data_objects/identity/group_assignee.rb} +4 -4
  43. data/lib/kuality-coeus/data_objects/identity/role.rb +124 -0
  44. data/lib/kuality-coeus/data_objects/identity/role_assignee.rb +43 -0
  45. data/lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb +87 -4
  46. data/lib/kuality-coeus/data_objects/institutional_proposal/ip_cost_sharing.rb +61 -0
  47. data/lib/kuality-coeus/data_objects/institutional_proposal/project_personnel.rb +35 -0
  48. data/lib/kuality-coeus/data_objects/institutional_proposal/unrecovered_fa.rb +64 -0
  49. data/lib/kuality-coeus/data_objects/maintenance/budget_column.rb +89 -0
  50. data/lib/kuality-coeus/data_objects/navigation.rb +12 -0
  51. data/lib/kuality-coeus/data_objects/proposal_development/degrees.rb +2 -2
  52. data/lib/kuality-coeus/data_objects/proposal_development/key_personnel.rb +6 -5
  53. data/lib/kuality-coeus/data_objects/proposal_development/personnel_attachments.rb +3 -3
  54. data/lib/kuality-coeus/data_objects/proposal_development/proposal_attachments.rb +3 -3
  55. data/lib/kuality-coeus/data_objects/proposal_development/proposal_development.rb +28 -34
  56. data/lib/kuality-coeus/data_objects/proposal_development/special_review.rb +3 -1
  57. data/lib/kuality-coeus/data_objects/proposal_log/proposal_log.rb +73 -0
  58. data/lib/kuality-coeus/data_objects/rates/institute_rate.rb +1 -0
  59. data/lib/kuality-coeus/data_objects/{user.rb → user/user.rb} +164 -146
  60. data/lib/kuality-coeus/data_objects/user/user_group.rb +36 -0
  61. data/lib/kuality-coeus/data_objects/user/user_role.rb +45 -0
  62. data/lib/kuality-coeus/page_objects/000_base_page.rb +27 -6
  63. data/lib/kuality-coeus/page_objects/budget/distribution_income.rb +14 -0
  64. data/lib/kuality-coeus/page_objects/central_admin.rb +2 -3
  65. data/lib/kuality-coeus/page_objects/identity/group.rb +2 -2
  66. data/lib/kuality-coeus/page_objects/identity/person.rb +7 -3
  67. data/lib/kuality-coeus/page_objects/identity/role.rb +38 -0
  68. data/lib/kuality-coeus/page_objects/institute_rates_maintenance.rb +18 -0
  69. data/lib/kuality-coeus/page_objects/institutional_proposal/institutional_proposal.rb +2 -0
  70. data/lib/kuality-coeus/page_objects/kc_protocol.rb +2 -0
  71. data/lib/kuality-coeus/page_objects/login.rb +1 -1
  72. data/lib/kuality-coeus/page_objects/lookup_pages/000_lookups.rb +1 -0
  73. data/lib/kuality-coeus/page_objects/lookup_pages/award_lookup.rb +5 -0
  74. data/lib/kuality-coeus/page_objects/lookup_pages/award_status_lookup.rb +5 -0
  75. data/lib/kuality-coeus/page_objects/lookup_pages/budget_columns_to_alter_lookup.rb +7 -0
  76. data/lib/kuality-coeus/page_objects/lookup_pages/campus_lookup.rb +10 -0
  77. data/lib/kuality-coeus/page_objects/lookup_pages/campus_type_lookup.rb +6 -0
  78. data/lib/kuality-coeus/page_objects/lookup_pages/group_lookup.rb +2 -0
  79. data/lib/kuality-coeus/page_objects/lookup_pages/institutional_proposal_lookup.rb +9 -0
  80. data/lib/kuality-coeus/page_objects/lookup_pages/institutional_proposal_person_lookup.rb +3 -0
  81. data/lib/kuality-coeus/page_objects/lookup_pages/kim_type_lookup.rb +6 -0
  82. data/lib/kuality-coeus/page_objects/lookup_pages/proposal_development_document_lookup.rb +5 -0
  83. data/lib/kuality-coeus/page_objects/lookup_pages/proposal_log_lookup.rb +5 -0
  84. data/lib/kuality-coeus/page_objects/lookup_pages/proposal_status_lookup.rb +5 -0
  85. data/lib/kuality-coeus/page_objects/lookup_pages/proposal_type_lookup.rb +5 -0
  86. data/lib/kuality-coeus/page_objects/lookup_pages/research_areas_lookup.rb +5 -0
  87. data/lib/kuality-coeus/page_objects/lookup_pages/role_lookup.rb +2 -2
  88. data/lib/kuality-coeus/page_objects/lookup_pages/sponsor_type_lookup.rb +6 -0
  89. data/lib/kuality-coeus/page_objects/lookup_pages/unit_lookup.rb +2 -0
  90. data/lib/kuality-coeus/page_objects/maintenance.rb +1 -1
  91. data/lib/kuality-coeus/page_objects/maintenance/budget_column_to_alter.rb +12 -0
  92. data/lib/kuality-coeus/page_objects/proposal_development/proposal_actions.rb +9 -0
  93. data/lib/kuality-coeus/page_objects/proposal_development/s2s.rb +1 -1
  94. data/lib/kuality-coeus/page_objects/proposal_log/proposal_log.rb +23 -0
  95. data/lib/kuality-coeus/page_objects/protocol/protocol_actions.rb +7 -0
  96. data/lib/kuality-coeus/page_objects/protocol/protocol_overview.rb +55 -0
  97. data/lib/kuality-coeus/page_objects/researcher.rb +1 -1
  98. data/lib/kuality-coeus/page_objects/system_admin.rb +1 -1
  99. data/lib/kuality-coeus/utilities.rb +8 -1
  100. metadata +45 -10
  101. data/features/proposal_development/special_review_validations.feature +0 -12
  102. data/features/step_definitions/delete_proposals.rb +0 -9
  103. data/features/step_definitions/test.rb +0 -12
  104. data/features/test.feature +0 -8
@@ -7,7 +7,7 @@ Then /^the (.*) user is listed as an? (.*) in the proposal permissions$/ do |use
7
7
  end
8
8
 
9
9
  When /^I? ?assign the (.*) user as an? (.*) in the proposal permissions$/ do |system_role, role|
10
- set(system_role, (make UserObject, role: system_role))
10
+ make_user role: system_role
11
11
  @proposal.permissions.send(snake_case(role+'s')) << get(system_role).user_name
12
12
  @proposal.permissions.assign
13
13
  end
@@ -93,7 +93,7 @@ end
93
93
 
94
94
  And /^their proposal permissions allow them to delete the proposal$/ do
95
95
  on(Proposal).proposal_actions
96
- lambda{@proposal.delete}.should_not raise_error
96
+ expect{@proposal.delete}.should_not raise_error
97
97
  end
98
98
 
99
99
  Then /^there should be an error message that says not to select other roles alongside aggregator$/ do
@@ -125,3 +125,21 @@ Then /^the (.*) user should not be listed as an? (.*) in the second proposal$/ d
125
125
  page.assigned_to_role(role).should_not include "#{user.first_name} #{user.last_name}"
126
126
  end
127
127
  end
128
+
129
+ Then /^the user should be able to create a proposal$/ do
130
+ # Note that since this stepdef doesn't specify WHICH user, it's
131
+ # assuming that the one to use is the last one that was
132
+ # created/defined.
133
+ $users[-1].sign_in
134
+ expect{create ProposalDevelopmentObject}.not_to raise_error
135
+ end
136
+
137
+ Then /^I? ?can override the cost sharing amount$/ do
138
+ @proposal.view 'Proposal Actions'
139
+ on ProposalActions do |page|
140
+ page.expand_all
141
+ expect{page.budget_field.select 'Cost Sharing Amount'}.not_to raise_error
142
+ page.budget_changed_value.set '100'
143
+ expect{page.add_budget_change_data}.not_to raise_error
144
+ end
145
+ end
@@ -0,0 +1,13 @@
1
+ When(/^I initiate a proposal log document but I miss a required field$/) do
2
+ # Pick a field at random for the test...
3
+ @required_field = ['Title', 'Proposal Type', 'Lead Unit'
4
+ ].sample
5
+ # Properly set the nil value depending on the field type...
6
+ @required_field=~/Type/ ? value='select' : value=''
7
+ # Transform the field name to the appropriate symbol...
8
+ field =snake_case(@required_field)
9
+ @proposal_log = create ProposalLogObject, field=>value
10
+ end
11
+ When(/^I create a proposal log document$/) do
12
+ @proposal_log = create ProposalLogObject
13
+ end
@@ -0,0 +1,28 @@
1
+ When(/^I initiate an irb protocol$/) do
2
+ @irb_protocol = create IRBProtocolDevelopmentObject
3
+ end
4
+ When(/^I initiate a proposal with an invalid lead unit code$/) do
5
+ @irb_protocol = create IRBProtocolDevelopmentObject, :lead_unit=>'000000'
6
+ end
7
+ Then(/^I should see an error that says my lead unit code is invalid$/) do
8
+ on(ProtocolOverview).errors.should include 'Lead Unit is invalid.'
9
+ end
10
+
11
+ # Note: I created this step, in addition to create_proposal.rb, Line: 143 because
12
+ # the errors on this page are lame and include the name of the field twice.
13
+ # ex. "Doc Description (Description) is required."
14
+ Then /^an error should appear that says the field is required$/ do
15
+ text="#{@required_field} (#{@required_field}) is a required field."
16
+ @required_field=='Description' ? error='Document '+text : error=text
17
+ on(ProtocolOverview).errors.should include error
18
+ end
19
+ When(/^I? ?initiate an irb protocol but I miss a required field$/) do
20
+ # Pick a field at random for the test...
21
+ @required_field = ['Description', 'Title', 'Lead Unit'
22
+ ].sample
23
+ # Properly set the nil value depending on the field type...
24
+ @required_field= value=''
25
+ # Transform the field name to the appropriate symbol...
26
+ field = snake_case(@required_field)
27
+ @irb_protocol = create IRBProtocolDevelopmentObject, field=>value
28
+ end
@@ -0,0 +1,17 @@
1
+ When /^create a role with permission to create proposals$/ do
2
+ role = make_role permissions: %w{842}
3
+ role.create
4
+ end
5
+
6
+ When /^I? ?add the group to the role$/ do
7
+ @role.add_assignee type_code: 'Group', member_identifier: @group.id
8
+ end
9
+
10
+ When /^the '(.*)' role exists$/ do |role|
11
+ make_role name: role
12
+ get(role).create unless get(role).exists?
13
+ end
14
+
15
+ When /^I? ?add the group to the '(.*)' role$/ do |role|
16
+ get(role).add_assignee type_code: 'Group', member_identifier: @group.id
17
+ end
@@ -1,14 +1,21 @@
1
+ # We need this step def because of the special case of
2
+ # the admin user. Its data object is already created
3
+ # and added to the Users collection at the start of the
4
+ # scripts.
5
+ Given /^I'm( signed)? in as the admin$/ do |x|
6
+ $users.admin.sign_in
7
+ end
8
+
1
9
  # Note the difference between the following three
2
10
  # step definitions...
3
11
 
4
- # This step definition
12
+ # This step definition is a bit dangerous
5
13
  # 1) Assumes that the user already exists in the system
6
14
  # 2) Assumes the user object does not exist, so it creates it, sticking it into
7
15
  # a class instance variable based on the username
8
16
  # 3) Logs that user in (if they're not already)...
9
17
  Given /^I'm logged in with (.*)$/ do |username|
10
- user = make_user user: username
11
- user.sign_in
18
+ make_user(user: username).sign_in
12
19
  end
13
20
 
14
21
  # Whereas, this step def
@@ -52,12 +59,40 @@ Given /^users exist with the following roles: (.*)$/ do |roles|
52
59
  end
53
60
 
54
61
  Given /^a user exists that can be a PI for Grants.gov proposals$/ do
55
- @grants_gov_pi = make_user user: UserObject::USERS.grants_gov_pi
56
- @grants_gov_pi.create unless @grants_gov_pi.exists?
62
+ make_user(user: UserObject::USERS.grants_gov_pi, type: 'Grants.gov PI')
63
+ $users[-1].create unless $users[-1].exists?
57
64
  end
58
65
 
59
66
  Given /^an AOR user exists$/ do
60
- # TODO: Using the quickstart user here is cheating. Fix this.
61
- @aor = make_user user: 'quickstart'
67
+ # TODO: Using the username here is cheating. Fix this.
68
+ @aor = make_user(user: 'warrens', type: 'AOR')
62
69
  @aor.create unless @aor.exists?
70
+ end
71
+
72
+ When /^I? ?create an? '(.*)' user$/ do |type|
73
+ $users << create(UserObject, type: type)
74
+ end
75
+
76
+ Given /^I? ?create a user with an? (.*) role in the (.*) unit$/ do |role, unit|
77
+ role_num = RoleObject::ROLES[role]
78
+ $users << create(UserObject, rolez: [{ id: role_num, name: role, qualifiers: [{:unit=>unit}] }] )
79
+ end
80
+
81
+ Given /^I? ?log in as the user with the (.*) role in (.*)$/ do |role, unit|
82
+ $users.with_role_in_unit(role, unit).sign_in
83
+ end
84
+
85
+ When /^I? ?log in with that user$/ do
86
+ $users[-1].sign_in
87
+ end
88
+
89
+ And /^I add the (.*) role in the (.*) unit to that user$/ do |role, unit|
90
+ role_num = RoleObject::ROLES[role]
91
+ $users[-1].add_role id: role_num, name: role, qualifiers: [{:unit=>unit}], user_name: $users[-1].user_name
92
+ end
93
+
94
+ # Use this step def when you know the role doesn't take a qualifier
95
+ And /^I add the (.*) role to that user$/ do |role|
96
+ role_num = RoleObject::ROLES[role]
97
+ $users[-1].add_role id: role_num, name: role, qualifiers: [], user_name: $users[-1].user_name
63
98
  end
@@ -26,10 +26,25 @@ World DateFactory
26
26
  World Utilities
27
27
 
28
28
  kuality = Kuality.new @config[:browser]
29
+ $users = Users.instance
29
30
 
30
31
  Before do
31
32
  @browser = kuality.browser
33
+ $users.clear
34
+ # Add the admin user to the Users...
35
+ $users << UserObject.new(@browser)
36
+ end
37
+
38
+ After do |scenario|
39
+
40
+ if scenario.failed?
41
+ @browser.screenshot.save 'screenshot.png'
42
+ embed 'screenshot.png', 'image/png'
43
+ end
44
+
45
+ $users.current_user.sign_out unless $users.current_user==nil
46
+
32
47
  end
33
48
 
34
49
  # Comment out to help with debugging...
35
- # at_exit { kuality.browser.close }
50
+ at_exit { kuality.browser.close }
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'kuality-coeus'
3
- s.version = '0.0.5'
3
+ s.version = '0.0.6'
4
4
  s.summary = %q{rSmart's test framework for BDD testing of Kuali Coeus}
5
5
  s.description = %q{This gem is used for creating test scripts for Kuali Coeus.}
6
6
  s.files = Dir.glob("**/**/**")
@@ -8,6 +8,6 @@ spec = Gem::Specification.new do |s|
8
8
  s.authors = ["Abraham Heward", "Jon Utter"]
9
9
  s.email = %w{"aheward@rsmart.com" "jutter@rsmart.com"}
10
10
  s.homepage = 'https://github.com/rSmart'
11
- s.add_dependency 'test-factory', '>= 0.2.9'
11
+ s.add_dependency 'test-factory', '>= 0.3.1'
12
12
  s.required_ruby_version = '>= 1.9.3'
13
13
  end
data/lib/kuality-coeus.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'singleton'
1
2
  require 'test-factory'
2
3
  require 'date'
3
4
  require 'yaml'
@@ -22,15 +22,15 @@ class AwardObject
22
22
  award_title: random_alphanums,
23
23
  activity_type: '::random::',
24
24
  award_type: '::random::',
25
- project_start_date: right_now, # Note how this is the date hash, for increased flexibility of validations or tests, if necessary
26
- project_end_date: in_a_year, # Same goes for this variable. It's the entire date hash
25
+ project_start_date: right_now[:date_w_slashes],
26
+ project_end_date: in_a_year[:date_w_slashes],
27
27
  sponsor_id: '::random::',
28
28
  lead_unit: '::random::',
29
- obligation_start_date: right_now, # Date hash, again
30
- obligation_end_date: in_a_year, # and again
29
+ obligation_start_date: right_now[:date_w_slashes],
30
+ obligation_end_date: in_a_year[:date_w_slashes],
31
31
  anticipated_amount: '1000000',
32
32
  obligated_amount: '1000000',
33
- transactions: TransactionCollection.new
33
+ transactions: collection('Transaction')
34
34
  }
35
35
 
36
36
  set_options(defaults.merge(opts))
@@ -42,11 +42,9 @@ class AwardObject
42
42
  on Award do |create|
43
43
  create.expand_all
44
44
  fill_out create, :description, :transaction_type, :award_status, :award_title,
45
- :activity_type, :award_type, :obligated_amount, :anticipated_amount
46
- create.project_start_date.fit @project_start_date[:date_w_slashes]
47
- create.project_end_date.fit @project_end_date[:date_w_slashes]
48
- create.obligation_start_date.fit @obligation_start_date[:date_w_slashes]
49
- create.obligation_end_date.fit @obligation_end_date[:date_w_slashes]
45
+ :activity_type, :award_type, :obligated_amount, :anticipated_amount,
46
+ :project_start_date, :project_end_date, :obligation_start_date,
47
+ :obligation_end_date
50
48
  set_sponsor_id
51
49
  set_lead_unit
52
50
  create.save
@@ -66,10 +64,7 @@ class AwardObject
66
64
 
67
65
  def add_transaction opts={}
68
66
  defaults={award_id: @award_id}
69
- options = defaults.merge(opts)
70
- trans = make AwardTransactionObject, options
71
- trans.create
72
- @transactions << trans
67
+ @transactions.add defaults.merge(opts)
73
68
  end
74
69
 
75
70
  # ========
@@ -106,6 +101,10 @@ class AwardObject
106
101
  end
107
102
  end
108
103
 
104
+ # ==========
105
+ private
106
+ # ==========
107
+
109
108
  def navigate
110
109
  doc_search unless on_award?
111
110
  on(TimeAndMoney).return_to_award if on_tm?
@@ -52,6 +52,8 @@ class AwardTransactionObject
52
52
 
53
53
  end # AwardTransactionObject
54
54
 
55
- class TransactionCollection < Array
55
+ class TransactionCollection < CollectionsFactory
56
+
57
+ contains AwardTransactionObject
56
58
 
57
59
  end # TransactionCollection
@@ -8,18 +8,20 @@ class BudgetPeriodObject
8
8
  attr_accessor :number, :start_date, :end_date, :total_sponsor_cost,
9
9
  :direct_cost, :f_and_a_cost, :unrecovered_f_and_a,
10
10
  :cost_sharing, :cost_limit, :direct_cost_limit, :datified,
11
- :budget_name
11
+ :budget_name, :cost_sharing_distribution_list
12
12
 
13
13
  def initialize(browser, opts={})
14
14
  @browser = browser
15
15
 
16
16
  defaults = {
17
- doc_type: 'Budget Document ' # Note: the trailing space is not a typo!
17
+ doc_type: 'Budget Document ', # Note: the trailing space is not a typo!
18
+ cost_sharing_distribution_list: collection('CostSharing')
18
19
  }
19
20
 
20
21
  set_options(defaults.merge(opts))
21
22
  requires :start_date, :budget_name
22
23
  datify
24
+ add_cost_sharing @cost_sharing
23
25
  end
24
26
 
25
27
  def create
@@ -50,6 +52,7 @@ class BudgetPeriodObject
50
52
  end
51
53
  set_options(opts)
52
54
  datify
55
+ add_cost_sharing opts[:cost_sharing]
53
56
  end
54
57
 
55
58
  def delete
@@ -93,9 +96,20 @@ class BudgetPeriodObject
93
96
  @datified=Date.parse(@start_date[/(?<=\/)\d+$/] + '/' + @start_date[/^\d+\/\d+/])
94
97
  end
95
98
 
99
+ def add_cost_sharing(cost_sharing)
100
+ if !cost_sharing.nil? && cost_sharing.to_f > 0
101
+ cs = make CostSharingObject, project_period: @number,
102
+ amount: cost_sharing, source_account: '',
103
+ index: @cost_sharing_distribution_list.length
104
+ @cost_sharing_distribution_list << cs
105
+ end
106
+ end
107
+
96
108
  end # BudgetPeriodObject
97
109
 
98
- class BudgetPeriodsCollection < Array
110
+ class BudgetPeriodsCollection < CollectionsFactory
111
+
112
+ contains BudgetPeriodObject
99
113
 
100
114
  def period(number)
101
115
  self.find { |period| period.number==number }
@@ -21,12 +21,10 @@ class BudgetVersionsObject
21
21
  @browser = browser
22
22
 
23
23
  defaults = {
24
- name: random_alphanums_plus(40),
25
- cost_sharing: '0.00',
26
- f_and_a: '0.00',
27
- budget_periods: BudgetPeriodsCollection.new,
28
- subaward_budgets: SubawardBudgetCollection.new,
29
- personnel: BudgetPersonnelCollection.new
24
+ name: random_alphanums_plus(40),
25
+ budget_periods: collection('BudgetPeriods'),
26
+ subaward_budgets: collection('SubawardBudget'),
27
+ personnel: collection('BudgetPersonnel')
30
28
  }
31
29
 
32
30
  set_options(defaults.merge(opts))
@@ -71,11 +69,8 @@ class BudgetVersionsObject
71
69
  budget_name: @name,
72
70
  doc_type: @doc_header
73
71
  }
74
- opts.merge!(defaults)
75
-
76
- bp = create BudgetPeriodObject, opts
72
+ @budget_periods.add defaults.merge(opts)
77
73
  return if on(Parameters).errors.size > 0 # No need to continue the method if we have an error
78
- @budget_periods << bp
79
74
  @budget_periods.number! # This updates the number value of all periods, as necessary
80
75
  end
81
76
 
@@ -98,7 +93,7 @@ class BudgetVersionsObject
98
93
  confirmation
99
94
  on Parameters do |edit|
100
95
  edit.final.fit opts[:final]
101
- edit.budget_status.fit opts[:budget_status]
96
+ edit.budget_status.fit opts[:status]
102
97
  edit.total_direct_cost_limit.fit opts[:total_direct_cost_limit]
103
98
  # TODO: More to add here...
104
99
  edit.save
@@ -219,7 +214,9 @@ class BudgetVersionsObject
219
214
 
220
215
  end # BudgetVersionsObject
221
216
 
222
- class BudgetVersionsCollection < Array
217
+ class BudgetVersionsCollection < CollectionsFactory
218
+
219
+ contains BudgetVersionsObject
223
220
 
224
221
  def budget(name)
225
222
  self.find { |budget| budget.name==name }
@@ -0,0 +1,56 @@
1
+ class CostSharingObject
2
+
3
+ include Foundry
4
+ include DataFactory
5
+ include StringFactory
6
+ include Navigation
7
+
8
+ attr_accessor :project_period, :percentage, :source_account, :amount, :index
9
+
10
+ def initialize(browser, opts={})
11
+ @browser = browser
12
+
13
+ defaults = {
14
+ percentage: '0.00',
15
+ source_account: random_alphanums
16
+ }
17
+ set_options(defaults.merge(opts))
18
+ end
19
+
20
+ def create
21
+ view
22
+ on DistributionAndIncome do |page|
23
+ page.add_cost_share_period.set @project_period
24
+ # TODO: Add more here when needed
25
+ page.add
26
+ end
27
+ end
28
+
29
+ def view
30
+ # Note: Currently assumes we're already viewing
31
+ # the budget document!
32
+ on(Parameters).distribution__income
33
+ end
34
+
35
+ def edit(opts)
36
+ view
37
+ on DistributionAndIncome do |page|
38
+ page.expand_all
39
+ page.cost_sharing_project_period(@index).fit opts[:project_period]
40
+ page.cost_sharing_percentage(@index).fit opts[:percentage]
41
+ page.cost_sharing_source_account(@index).fit opts[:source_account]
42
+ page.cost_sharing_amount(@index).fit opts[:amount]
43
+ page.save
44
+ end
45
+ update_options(opts)
46
+ end
47
+
48
+ end
49
+
50
+ class CostSharingCollection < CollectionsFactory
51
+
52
+ contains CostSharingObject
53
+
54
+ #TODO: Write code that will update indexes when items change their order in the list.
55
+
56
+ end