Sha256: 70ab2ea4742c3dd8ee055295a7e08c0b2bb32918058082e0f6086a1ac296b90f

Contents?: true

Size: 820 Bytes

Versions: 3

Compression:

Stored size: 820 Bytes

Contents

RSpec.describe Symphonia::User do
  subject { FactoryBot.create(:user, email: "test@dummy.com") }
  it "#like" do
    expect(Symphonia::User.like(subject.mail)).to be_all Symphonia::User
  end

  it "#to_s" do
    expect(subject.to_s).to eq "#{subject.first_name} #{subject.last_name}"
  end

  it "#name=" do
    subject.name = "Tata smoula"
    expect(subject.first_name).to eq "Tata"
    expect(subject.last_name).to eq "smoula"
  end


  describe "#required_password" do
    it "require password for internal" do
      expect { FactoryBot.create(:user, password: nil) }.to raise_error ActiveRecord::RecordInvalid
    end
    it "do not require password for external_ids" do
      expect { FactoryBot.create(:user, password: nil, external_id: "ex1") }.not_to raise_error ActiveRecord::RecordInvalid
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
symphonia-3.0.3 spec/models/user_spec.rb
symphonia-3.0.2 spec/models/user_spec.rb
symphonia-3.0.1 spec/models/user_spec.rb