Sha256: 6af4b992f58f1bac429e0224b863be96d33b9950fce88da67fc1ecb575af4b23

Contents?: true

Size: 996 Bytes

Versions: 6

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

describe Helena::Question do
  let!(:version) { create :version, survey: create(:survey) }
  let(:question_group) { build :question_group, version: version }

  it { expect(subject).to belong_to(:question_group) }

  it { expect(subject).to validate_presence_of(:code) }

  it 'validates uniqness of code across different question_groups' do
    a_question = build :question, question_group: question_group, code: :preferred_color
    expect(a_question).to be_valid

    another_question = build :question, question_group: question_group, code: :preferred_color
    expect(another_question).not_to be_valid
  end

  it 'has a valid factory' do
    expect(build(:question, question_group: question_group)).to be_valid
  end

  it 'indicates that it does not include sub_questions or labels' do
    question = build :question, question_group: question_group

    expect(question.includes_subquestions?).to eq false
    expect(question.includes_labels?).to eq false
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
helena-2.1.0 spec/models/helena/question_spec.rb
helena-2.0.2 spec/models/helena/question_spec.rb
helena-2.0.1 spec/models/helena/question_spec.rb
helena-2.0.0 spec/models/helena/question_spec.rb
helena-1.3.1 spec/models/helena/question_spec.rb
helena-1.3.0 spec/models/helena/question_spec.rb