Add survey related tests
This commit is contained in:
parent
68a8ec2204
commit
c278e547ce
8 changed files with 198 additions and 1 deletions
16
spec/models/survey_submission_spec.rb
Normal file
16
spec/models/survey_submission_spec.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe SurveySubmission do
|
||||
subject { create(:survey_submission) }
|
||||
|
||||
describe 'association' do
|
||||
it { is_expected.to belong_to(:survey) }
|
||||
it { is_expected.to belong_to(:user) }
|
||||
it { is_expected.to have_many(:survey_replies).through(:user) }
|
||||
it { is_expected.to accept_nested_attributes_for(:survey_replies) }
|
||||
end
|
||||
|
||||
describe 'validation' do
|
||||
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:survey_id) }
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue