Sha256: 4e75f39da0ed2d8b68d89f29b5d5d73eef05a340de8c7b449a37eed3a586a130

Contents?: true

Size: 1.21 KB

Versions: 34

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Quby::Questionnaires::Entities
  describe ScoreCalculation do
    let(:calculation) { proc { 1 } }
    subject { ScoreCalculation.new(:tot, label: "Totaal", sbg_key: 'TOT', &calculation) }

    it { expect(subject.key).to eq :tot }
    it { expect(subject.label).to eq "Totaal" }
    it { expect(subject.sbg_key).to eq "TOT" }
    it { expect(subject.calculation).to eq calculation }

    context 'when not given any options' do
      subject { ScoreCalculation.new(:tot, {}, &calculation) }
      it { expect(subject.label).to be_nil }
      it { expect(subject.sbg_key).to be_nil }
    end

    context 'when having a score option set to true' do
      subject { ScoreCalculation.new(:tot, {score: true}, &calculation) }
      it { expect(subject.score).to be_truthy }
    end
    context 'when having an action option set to true' do
      subject { ScoreCalculation.new(:tot, {action: true}, &calculation) }
      it { expect(subject.action).to be_truthy }
    end
    context 'when having a completion option set to true' do
      subject { ScoreCalculation.new(:tot, {completion: true}, &calculation) }
      it { expect(subject.completion).to be_truthy }
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-5.6.6 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.6.5 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.6.3 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.6.2 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.6.1 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.6.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.5.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.4.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.3.1 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.3.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.2.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.1.3 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.1.2 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.1.1 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.1.0 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.0.5 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.0.4 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.0.3 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.0.2 spec/quby/questionnaires/entities/score_calculation_spec.rb
quby-5.0.1 spec/quby/questionnaires/entities/score_calculation_spec.rb