Skip to content

Commit

Permalink
Tests/Survey: Update cucumber scenarios to handle radio inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
barnden committed Feb 16, 2024
1 parent 5956f37 commit 47eeb66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions rails_root/features/step_definitions/stepdefs.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
# Analysis Result Presentation Steps
Given('I have completed the survey with invalid inputs') do
@user_id = nil
@attributes = {}
SurveyResponse.column_names.each do |name|
@attributes[name] = nil if name != 'id' && name != 'created_at' && name != 'updated_at'
@attributes[name] = nil if not ['id', 'created_at', 'updated_at', 'user_id'].include? name
end
end

Given('I have completed the survey with valid inputs') do
@user_id = 1
@attributes = {}
SurveyResponse.column_names.each do |name|
@attributes[name] = 1 if name != 'id' && name != 'created_at' && name != 'updated_at'
@attributes[name] = nil if not ['id', 'created_at', 'updated_at', 'user_id'].include? name
end
end

When('I try to submit the form') do
visit new_survey_response_path
fill_in "survey_response_user_id", with: @user_id
@attributes.each do |key, value|
fill_in 'survey_response_' + key.to_s, with: value
choose "survey_response_#{key.to_s}_0"
end
click_button 'commit'
end
Expand Down

0 comments on commit 47eeb66

Please sign in to comment.