Sha256: a7ac5b16a435d0e364adfae980e307f009bd2cd1e0dbe6d996f8da5e9375bf55

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

require 'spec_helper'

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

  it { expect(subject).to be_embedded_in(: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: 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: :preferred_color
    expect(another_question).not_to be_valid
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helena-0.3.3 spec/models/helena/question_spec.rb