-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from tamu-edu-students/Role-based-survey-page
adding tests and groundwork to make survey response page render role-…
- Loading branch information
Showing
13 changed files
with
141 additions
and
14 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
2 changes: 1 addition & 1 deletion
2
rails_root/app/views/survey_profiles/_survey_profile.json.jbuilder
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,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
json.extract! survey_profile, :id, :user_id, :first_name, :last_name, :campus_name, :district_name, :created_at, | ||
:updated_at | ||
:updated_at, :role | ||
json.url survey_profile_url(survey_profile, format: :json) |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Feature: Specific Survey Questions Rendered based on User Role. | ||
Verify Survey Profile and Survey Response | ||
|
||
Scenario: User logs in for the first time and takes survey as a principal | ||
Given that I am on the homepage | ||
And I try to login | ||
And I have never created a survey profile | ||
Then I am redirected to the create survey profile page | ||
And I fill in my information as a principal | ||
Then a survey profile is created for me as a principal | ||
Then I am redirected to the home page | ||
Then I am logged in as a principal | ||
When I navigate to the survey page | ||
Then I should see the survey questions specific to the principal | ||
|
||
Scenario: User logs in for the first time and takes survey as a teacher | ||
Given that I am on the homepage | ||
And I try to login | ||
And I have never created a survey profile | ||
Then I am redirected to the create survey profile page | ||
And I fill in my information as a teacher | ||
Then a survey profile is created for me as a teacher | ||
Then I am redirected to the home page | ||
Then I am logged in as a teacher | ||
When I navigate to the survey page | ||
Then I should see the survey questions specific to the teacher | ||
|
||
Scenario: User logs in for the first time and takes survey as a superintendent | ||
Given that I am on the homepage | ||
And I try to login | ||
And I have never created a survey profile | ||
Then I am redirected to the create survey profile page | ||
And I fill in my information as a superintendent | ||
Then a survey profile is created for me as a superintendent | ||
Then I am redirected to the home page | ||
Then I am logged in as a superintendent | ||
When I navigate to the survey page | ||
Then I should see the survey questions specific to the superintendent |
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
79 changes: 79 additions & 0 deletions
79
rails_root/features/step_definitions/role_based_survey_steps.rb
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# frozen_string_literal: true | ||
|
||
Then('I fill in my information as a principal') do | ||
fill_in 'First name', with: 'John' | ||
fill_in 'Last name', with: 'Doe' | ||
fill_in 'Campus name', with: 'Joe Campus' | ||
fill_in 'District name', with: 'Joe District' | ||
select 'Principal', from: 'Role' | ||
click_button 'Create Survey profile' | ||
end | ||
|
||
Then('a survey profile is created for me as a principal') do | ||
profile = SurveyProfile.find_by_user_id('google-oauth2|100507718411999601151') | ||
expect(profile.role).to eq('Principal') | ||
expect(profile).not_to be_nil | ||
end | ||
|
||
Then('I am logged in as a principal') do | ||
expect(page).to have_content('John Doe - Welcome to Our Rails App') | ||
expect(page).to have_content('Role: Principal') | ||
end | ||
|
||
When('I navigate to the survey page') do | ||
visit new_survey_response_path | ||
end | ||
|
||
Then('I should see the survey questions specific to the principal') do | ||
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Principal') | ||
end | ||
|
||
|
||
|
||
Then('I fill in my information as a teacher') do | ||
fill_in 'First name', with: 'John' | ||
fill_in 'Last name', with: 'Doe' | ||
fill_in 'Campus name', with: 'Joe Campus' | ||
fill_in 'District name', with: 'Joe District' | ||
select 'Teacher', from: 'Role' | ||
click_button 'Create Survey profile' | ||
end | ||
|
||
Then('a survey profile is created for me as a teacher') do | ||
profile = SurveyProfile.find_by_user_id('google-oauth2|100507718411999601151') | ||
expect(profile.role).to eq('Teacher') | ||
expect(profile).not_to be_nil | ||
end | ||
|
||
Then('I am logged in as a teacher') do | ||
expect(page).to have_content('John Doe - Welcome to Our Rails App') | ||
expect(page).to have_content('Role: Teacher') | ||
end | ||
|
||
Then('I should see the survey questions specific to the teacher') do | ||
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Teacher') | ||
end | ||
|
||
Then('I fill in my information as a superintendent') do | ||
fill_in 'First name', with: 'John' | ||
fill_in 'Last name', with: 'Doe' | ||
fill_in 'Campus name', with: 'Joe Campus' | ||
fill_in 'District name', with: 'Joe District' | ||
select 'Superintendent', from: 'Role' | ||
click_button 'Create Survey profile' | ||
end | ||
|
||
Then('a survey profile is created for me as a superintendent') do | ||
profile = SurveyProfile.find_by_user_id('google-oauth2|100507718411999601151') | ||
expect(profile.role).to eq('Superintendent') | ||
expect(profile).not_to be_nil | ||
end | ||
|
||
Then('I am logged in as a superintendent') do | ||
expect(page).to have_content('John Doe - Welcome to Our Rails App') | ||
expect(page).to have_content('Role: Superintendent') | ||
end | ||
|
||
Then('I should see the survey questions specific to the superintendent') do | ||
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Superintendent') | ||
end |