Sha256: 55bd675e9b4cd29100804e14e354b57b9cf7a0de597f3fe02376b4c1a5366b6b
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe Helena::VersionPublisher do let!(:survey) { create :survey } let!(:base_version) { survey.versions.create version: 42 } let!(:survey_detail) { base_version.survey_detail = build :survey_detail } let!(:question_group) { base_version.question_groups.create } let!(:question) { build(:radio_matrix_question, code: 'abc', question_group: question_group) } let!(:label) { build(:label, text: 'xyz', value: 'asdf', question: question) } let!(:sub_question) { build(:sub_question, text: 'ymca', code: 'cde', question: question) } it 'creates a new version' do allow(DateTime).to receive(:now).and_return('Tue, 24 Jun 2014 10:24:08 +0200') new_version = Helena::VersionPublisher.publish(base_version) expect(new_version.version).to eq 43 expect(new_version.survey_detail).to be_a Helena::SurveyDetail expect(new_version).to have(1).question_groups expect(new_version.question_groups.first).to have_exactly(1).questions expect(new_version.question_groups.first.questions.first).to have_exactly(1).labels expect(new_version.question_groups.first.questions.first).to have_exactly(1).sub_questions expect(new_version.created_at).to eq 'Tue, 24 Jun 2014 10:24:08 +0200' expect(new_version.updated_at).to eq 'Tue, 24 Jun 2014 10:24:08 +0200' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
helena-0.3.3 | spec/lib/version_publisher_spec.rb |