-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c657e8f
commit bcb3ebe
Showing
12 changed files
with
23 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
ptime_base_test_url = "www.ptime.example.com" | ||
ptime_api_test_username = "test username" | ||
ptime_api_test_password = "test password" | ||
ENV["PTIME_BASE_URL"] = ptime_base_test_url | ||
ENV["PTIME_API_USERNAME"] = ptime_api_test_username | ||
ENV["PTIME_API_PASSWORD"] = ptime_api_test_password | ||
|
||
describe :people do | ||
describe 'People Search', type: :feature, js: true do | ||
employees_json = { | ||
'data' => [ | ||
{ | ||
'id' => 33, | ||
'type' => 'employee', | ||
'attributes' => { | ||
'shortname' => 'LSM', | ||
'firstname' => 'Longmax', | ||
'lastname' => 'Smith', | ||
'email' => '[email protected]', | ||
'marital_status' => 'single', | ||
'nationalities' => ['ZW'], | ||
'graduation' => 'BSc in Architecture', | ||
'department_shortname' => 'SYS', | ||
'employment_roles' => [] | ||
} | ||
}, | ||
{ | ||
'id' => 21, | ||
'type' => 'employee', | ||
'attributes' => { | ||
'shortname' => 'AMA', | ||
'firstname' => 'Alice', | ||
'lastname' => 'Mante', | ||
'full_name' => 'Alice Mante', | ||
'email' => '[email protected]', | ||
'marital_status' => 'single', | ||
'nationalities' => ['AU'], | ||
'graduation' => 'MSc in writing', | ||
'department_shortname' => 'SYS', | ||
'employment_roles' => [], | ||
'is_employed' => false, | ||
'birthdate' => '01.04.2001', | ||
'location' => 'Bern' | ||
} | ||
}, | ||
{ | ||
'id' => 45, | ||
'type' => 'employee', | ||
'attributes' => { | ||
'shortname' => 'CFO', | ||
'firstname' => 'Charlie', | ||
'lastname' => 'Ford', | ||
'email' => '[email protected]', | ||
'marital_status' => 'married', | ||
'nationalities' => ['GB'], | ||
'graduation' => 'MSc in networking', | ||
'department_shortname' => 'SYS', | ||
'employment_roles' => [] | ||
} | ||
} | ||
] | ||
}.to_json | ||
|
||
before(:each) do | ||
set_env_variables_and_stub_request | ||
ENV['LAST_PTIME_API_REQUEST'] = DateTime.current.to_s | ||
sign_in auth_users(:user), scope: :auth_user | ||
end | ||
|
||
|
@@ -114,9 +56,6 @@ | |
alice = people(:alice) | ||
alice.ptime_employee_id = 21 | ||
alice.save! | ||
stub_request(:get, "http://#{ptime_base_test_url}/api/v1/employees?per_page=1000"). | ||
to_return(body: employees_json, headers: { 'content-type': "application/vnd.api+json; charset=utf-8" }, status: 200) | ||
.with(basic_auth: [ptime_api_test_username, ptime_api_test_password]) | ||
visit people_path | ||
select_from_slim_select("#person_id_person", alice.name) | ||
expect(page).to have_current_path(person_path(alice)) | ||
|
@@ -265,6 +204,8 @@ def add_language(language) | |
|
||
describe 'Edit person', type: :feature, js: true do | ||
before(:each) do | ||
Capybara.page.driver.browser.manage.window.maximize | ||
set_env_variables_and_stub_request | ||
sign_in auth_users(:user), scope: :auth_user | ||
end | ||
|
||
|
@@ -349,6 +290,7 @@ def add_language(language) | |
|
||
describe 'Create person', type: :feature, js: true do | ||
before(:each) do | ||
set_env_variables_and_stub_request | ||
sign_in auth_users(:user), scope: :auth_user | ||
end | ||
|
||
|
@@ -382,6 +324,7 @@ def add_language(language) | |
let(:longmax) { people(:longmax) } | ||
|
||
before(:each) do | ||
set_env_variables_and_stub_request | ||
sign_in auth_users(:user), scope: :auth_user | ||
end | ||
|
||
|
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