Sha256: abf14bcf4321497660b1d3d3a49b8055b51b77338de9f5e36abdbeb11b3b956e

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require "rails_helper"

describe "Participant concern" do
  fixtures :participants, :users

  let(:participant) { participants(:participant_wo_membership1) }
  let(:user) { users(:clinician1) }

  describe "validate group_assigned_before_coach" do
    context "Assigning coach to participant" do
      it "does not allow a coach to be assigned if a group has not been assigned" do
        participant.coach = user
        participant.save
        expect(participant.errors.count).to eql 1
      end
    end
  end

  describe "when validating phone number" do
    let(:number) { "6082154618" }

    describe "when valid" do
      it "doesn't return an error" do
        participant.phone_number = "1#{number}"
        participant.save

        expect(participant.errors[:phone_number])
          .to be_empty
      end
    end

    describe "when invalid" do
      it "returns an error" do
        participant.phone_number = number
        participant.save

        expect(participant.errors[:phone_number])
          .to_not be_empty
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
think_feel_do_dashboard-1.2.0.beta1 spec/models/concerns/participants_spec.rb
think_feel_do_dashboard-1.1.21 spec/models/concerns/participants_spec.rb
think_feel_do_dashboard-1.1.20 spec/models/concerns/participants_spec.rb
think_feel_do_dashboard-1.1.19 spec/models/concerns/participants_spec.rb
think_feel_do_dashboard-1.1.18 spec/models/concerns/participants_spec.rb