-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec for SubmissionParametersProjection
- Loading branch information
1 parent
70bfd66
commit 33b34f5
Showing
2 changed files
with
18 additions
and
1 deletion.
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
17 changes: 17 additions & 0 deletions
17
spec/models/dragnet/survey/submission_parameters_projection_spec.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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
describe Dragnet::Survey::SubmissionParametersProjection do | ||
subject(:projection) { described_class.new(survey) } | ||
|
||
let(:survey) { Dragnet::Survey.generate! } | ||
|
||
it 'includes id and survey_id' do | ||
expect(projection.project).to include(:id, :survey_id) | ||
end | ||
|
||
it 'includes the correct attributes that are required for answer submission' do | ||
attributes = %i[question_id reply_id survey_id question_type_id value] | ||
|
||
expect(projection.project.last[:answers_attributes].values.first).to eq(attributes) | ||
end | ||
end |