Sha256: cc263422333f4fa1fee4bc07244ef90dd0864525da19854544d9a7ab63b89588

Contents?: true

Size: 723 Bytes

Versions: 6

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'

describe Helena::Version do
  it { expect(subject).to belong_to(:survey) }

  it { expect(subject).to have_many(:question_groups).with_dependent(:destroy) }
  it { expect(subject).to embed_one(:survey_detail) }

  it { expect(subject).to validate_presence_of(:version) }
  it { expect(subject).to validate_uniqueness_of(:version) }

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

  it 'scopes active versions' do
    survey = create :survey
    survey.versions.create version: 0
    survey.versions.create active: true, version: 1

    expect(survey.reload.versions.size).to eq 2
    expect(survey.reload.versions.active.size).to eq 1
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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