-
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.
Add happy and sad paths for query survey feature (#48)
* adding happy and sad path for query survey feature, implementing all necessary logic * making rubocop happy
- Loading branch information
1 parent
849dbd9
commit a4f93c1
Showing
8 changed files
with
100 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Query Survey information | ||
Verify researchers and users can query survey responses with unique case number | ||
|
||
Scenario: | ||
Given survey profiles exist | ||
And survey responses exist | ||
And I am on the survey responses page | ||
When I enter a unique case number in the "Query by case number field" | ||
Then I see a list of survey responses with that case number | ||
|
||
Scenario: | ||
Given survey profiles exist | ||
And survey responses exist | ||
And I am on the survey responses page | ||
When I enter a unique case number with no linked survey responses in the "Query by case number field" | ||
Then I don't see a list of survey_responses with that case number | ||
And a warning is flashed | ||
|
||
|
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
39 changes: 39 additions & 0 deletions
39
rails_root/features/step_definitions/query_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,39 @@ | ||
# frozen_string_literal: true | ||
|
||
Given('survey responses exist') do | ||
SurveyResponse.create!(profile_id: 1, share_code: '123') | ||
SurveyResponse.create!(profile_id: 2, share_code: '456') | ||
end | ||
|
||
Given('I am on the survey responses page') do | ||
visit survey_responses_path | ||
end | ||
|
||
When('I enter a unique case number in the {string}') do |_string| | ||
fill_in 'query', with: '123' | ||
click_button 'Search' | ||
end | ||
|
||
Then('I see a list of survey responses with that case number') do | ||
# expect there to be survey responses with the case number in the table of survey responses | ||
within 'table' do | ||
expect(page).to have_content('123') | ||
end | ||
end | ||
|
||
When('I enter a unique case number with no linked survey responses in the {string}') do |_string| | ||
fill_in 'query', with: '789' | ||
click_button 'Search' | ||
end | ||
|
||
Then("I don't see a list of survey_responses with that case number") do | ||
# expect there to be no survey responses with the case number in the table of survey responses | ||
within 'table' do | ||
expect(page).not_to have_content('789') | ||
end | ||
end | ||
|
||
Then('a warning is flashed') do | ||
# expect there to be a warning flashed | ||
expect(page).to have_content('No survey responses found for share code 789') | ||
end |