Sha256: 3cf6e234241bbc9fd333972e41ccda5ea4bc5ec34ca8140f157675e32dd10800

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'spec_helper'

describe Rapidfire::Answer do
  describe "Validations" do
    subject { FactoryBot.build(:answer) }
    it { is_expected.to validate_presence_of(:question)      }
    it { is_expected.to validate_presence_of(:attempt)  }

    context "when validations are run" do
      let(:answer)  { FactoryBot.build(:answer) }

      it "delegates validation of answer text to question" do
        expect(answer.question).to receive(:validate_answer).with(answer).once
        expect(answer.valid?).to be_truthy
      end
    end
  end

  describe "Associations" do
    it { is_expected.to belong_to(:question)     }
    it { is_expected.to belong_to(:attempt) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapidfire-8.0.0 spec/models/rapidfire/answer_spec.rb