Sha256: c1641107d3c01026f6c8ed06f3f41ea55f1c485834699296692d83faf9b0ce1d

Contents?: true

Size: 992 Bytes

Versions: 5

Compression:

Stored size: 992 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

module SocialNetworking
  module Concerns
    RSpec.describe Participant do
      describe "validations" do
        context "contact preference is selected" do
          it "is invalid if email is not provided" do
            expect(::Participant
              .new(contact_preference: "email")
              .tap(&:valid?)
              .errors[:email]).to include "can't be blank"
          end

          it "is invalid if phone number is not provided" do
            expect(::Participant
              .new(contact_preference: "sms")
              .tap(&:valid?)
              .errors[:phone_number]).to include "can't be blank"
          end

          it "is invalid if phone number is not provided" do
            expect(::Participant
              .new(contact_preference: "phone")
              .tap(&:valid?)
              .errors[:phone_number]).to include "can't be blank"
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/models/social_networking/concerns/participant_spec.rb
social_networking-0.13.2 spec/models/social_networking/concerns/participant_spec.rb
social_networking-0.13.1 spec/models/social_networking/concerns/participant_spec.rb
social_networking-0.13.0 spec/models/social_networking/concerns/participant_spec.rb
social_networking-0.12.0 spec/models/social_networking/concerns/participant_spec.rb