Sha256: 21ada7825ea9538a41a72c77f0b29811b3731ca4a4ae331a2bebc3802e6a0971

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe Helena::Questions::RadioGroup do
  let!(:version) { build :version, survey: build(:survey) }

  let(:question_group) { build :question_group, version: version }

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

  it 'validates uniquness of label preselection' do
    question = create :radio_group_question, question_group: question_group
    question.labels << build(:label, preselected: true)
    question.labels << build(:label, preselected: true)
    expect(question).not_to be_valid
  end

  it 'does not validates uniquness of label preselection for no preselection' do
    question = create :radio_group_question, question_group: question_group
    question.labels << build(:label, preselected: false)
    question.labels << build(:label, preselected: false)
    expect(question).to be_valid
  end

  it 'does not validates uniquness of label preselection for one preselection' do
    question = create :radio_group_question, question_group: question_group
    question.labels << build(:label, preselected: false)
    question.labels << build(:label, preselected: false)
    expect(question).to be_valid
  end

  it 'indicates that it includes labels' do
    question = build :radio_group_question, question_group: question_group

    expect(question.includes_labels?).to eq true
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
helena-1.1.0 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.3 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.2 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.1 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.0.rc4 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.0.rc3 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.0.rc2 spec/models/helena/questions/radio_group_spec.rb
helena-1.0.0.rc1 spec/models/helena/questions/radio_group_spec.rb