-
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.
* Changed survey profile user_id to not null * Updated cucumber tests
- Loading branch information
1 parent
23fb37e
commit a438cf7
Showing
9 changed files
with
138 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class EditSurveyProfiles < ActiveRecord::Migration[7.1] | ||
def change | ||
change_column_null :survey_profiles, :user_id, false | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
Feature: Reworked Project Data Models | ||
Verify the correctness of the data models | ||
|
||
Scenario: Invalid model attributes | ||
Given I have an invalid set of attributes for all models | ||
When I try to create model instances | ||
| model_name | | ||
| SurveyQuestion | | ||
| SurveyProfile | | ||
| SurveyResponse | | ||
| SurveyAnswer | | ||
Then the models were not created | ||
|
||
Scenario: Valid model attributes | ||
Given I have an valid set of attributes for all models | ||
When I try to create model instances | ||
| model_name | | ||
| SurveyQuestion | | ||
| SurveyProfile | | ||
| SurveyResponse | | ||
| SurveyAnswer | | ||
Then the models were created |
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
17 changes: 14 additions & 3 deletions
17
rails_root/features/step_definitions/data_model_design_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
60 changes: 60 additions & 0 deletions
60
rails_root/features/step_definitions/model_rework_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,60 @@ | ||
Given('I have an invalid set of attributes for all models') do | ||
@model_attributes = {} | ||
|
||
@model_attributes['SurveyQuestion'] = {} | ||
SurveyQuestion.column_names.each do |name| | ||
@model_attributes['SurveyQuestion'][name] = nil if name != 'id' && name != 'created_at' && name != 'updated_at' | ||
end | ||
|
||
@model_attributes['SurveyProfile'] = {} | ||
SurveyProfile.column_names.each do |name| | ||
@model_attributes['SurveyProfile'][name] = nil if name != 'id' && name != 'created_at' && name != 'updated_at' | ||
end | ||
|
||
@model_attributes['SurveyResponse'] = {} | ||
SurveyResponse.column_names.each do |name| | ||
@model_attributes['SurveyResponse'][name] = nil if name != 'id' && name != 'created_at' && name != 'updated_at' | ||
end | ||
|
||
@model_attributes['SurveyAnswer'] = {} | ||
SurveyAnswer.column_names.each do |name| | ||
@model_attributes['SurveyAnswer'][name] = nil if name != 'id' && name != 'created_at' && name != 'updated_at' | ||
end | ||
end | ||
|
||
Then('the models were not created') do | ||
expect(SurveyQuestion.last).to be_nil | ||
expect(SurveyProfile.last).to be_nil | ||
expect(SurveyResponse.last).to be_nil | ||
expect(SurveyAnswer.last).to be_nil | ||
end | ||
|
||
Given('I have an valid set of attributes for all models') do | ||
@model_attributes = {} | ||
|
||
@model_attributes['SurveyQuestion'] = {} | ||
SurveyQuestion.column_names.each do |name| | ||
@model_attributes['SurveyQuestion'][name] = 10 if name != 'created_at' && name != 'updated_at' | ||
end | ||
|
||
@model_attributes['SurveyProfile'] = {} | ||
SurveyProfile.column_names.each do |name| | ||
@model_attributes['SurveyProfile'][name] = 10 if name != 'created_at' && name != 'updated_at' | ||
end | ||
|
||
@model_attributes['SurveyResponse'] = {} | ||
@model_attributes['SurveyResponse']['id'] = 10 | ||
@model_attributes['SurveyResponse']['profile_id'] = 10 | ||
|
||
@model_attributes['SurveyAnswer'] = {} | ||
SurveyAnswer.column_names.each do |name| | ||
@model_attributes['SurveyAnswer'][name] = 10 if name != 'created_at' && name != 'updated_at' | ||
end | ||
end | ||
|
||
Then('the models were created') do | ||
expect(SurveyQuestion.last).to be_truthy | ||
expect(SurveyProfile.last).to be_truthy | ||
expect(SurveyResponse.last).to be_truthy | ||
expect(SurveyAnswer.last).to be_truthy | ||
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
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