Sha256: c879ecbd1d1f50b35a7a41222aebf2ce3d162d62e85ad7ef00f9445d821798fb
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' describe Helena::SubQuestion do let(:version) { create :version, survey: create(:survey) } let(:question_group) { build :question_group, version: version } let(:question) { build :radio_matrix_question, question_group: question_group } it { expect(subject).to be_embedded_in(:question) } it { expect(subject).to validate_uniqueness_of(:text) } it { expect(subject).to validate_presence_of(:text) } it 'validates uniqness of code across different question_groups with subquestions' do a_question = build :question, question_group: build(:question_group, version: version), code: :preferred_color expect(a_question).to be_valid another_question = build :question, question_group: build(:question_group, version: version), code: :colors sub_question = build :sub_question, question: another_question, code: :some_code expect(sub_question).to be_valid another_sub_question = build :sub_question, question: another_question, code: :preferred_color expect(another_sub_question).not_to be_valid end it 'has a valid factory' do expect(build :sub_question, question: question).to be_valid end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
helena-1.0.0.rc1 | spec/models/helena/sub_question_spec.rb |
helena-0.3.3 | spec/models/helena/sub_question_spec.rb |