Created
March 30, 2016 16:54
-
-
Save jcreed/34ca9e7b62ba1317ecc08ea2bcc9e5c6 to your computer and use it in GitHub Desktop.
background check test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
feature 'Background Checks' do | |
let(:background_check_account) { create :background_check_account } | |
let(:background_check_request) { create :background_check_request, applicant: designation.applicant, background_check_account: background_check_account } | |
let(:designation) { create :designation_with_applicant, program: program } | |
let(:program) { background_check_account.program } | |
let(:user_identity) { create :organization_user_identity_for_integration_tests, cas: program.cas, programs: [program] } | |
let(:feature_assignment) { create :feature_assignment, feature: background_check_feature, assignee: program.cas } | |
let(:base_role) { create :role, rights: [personal_info_feature.base_right, *background_check_feature.rights] } | |
let(:personal_info_feature) { create :feature, name: 'applicant_personal_information' } | |
let(:background_check_feature) { create :background_check_feature } | |
def click_personal_information_pane | |
login(user_identity.user) | |
visit applicant_path(designation.applicant) | |
page.find("#personal_information_pane").click | |
end | |
before do | |
designation.save! | |
feature_assignment.save! | |
user_identity.roles << base_role | |
background_check_request.save! | |
end | |
[%w(completed View\ Results), %w(pending Send\ new\ eVite)].each do |identifier, button_text| | |
scenario "when an background check request is #{identifier}" do | |
background_check_account.opt_in = true | |
background_check_account.save | |
background_check_request.status.update_attributes!(identifier: identifier) | |
click_personal_information_pane | |
page.find("#background_check_info").click | |
page.must_have_link "Background Check" | |
page.must_have_content button_text | |
end | |
end | |
scenario "Background check not enabled" do | |
click_personal_information_pane | |
page.wont_have_link "Background Check" | |
page.wont_have_content "Background Check" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment