Sha256: fc3806a4d047f51ec1acf809ce1e1b38e3af5271cdff1257ef053d46b90aa675

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'spec_helper'

describe Partner do
  it { is_expected.to be_a_kind_of Persona::Partner }

  it { is_expected.to belong_to(:company) }
  it { is_expected.to belong_to(:person) }

  it { is_expected.to validate_presence_of :person }
  it { is_expected.to validate_presence_of :percentage }

  it { is_expected.to allow_value(100).for(:percentage) }
  it { is_expected.to allow_value(0.01).for(:percentage) }
  it { is_expected.not_to allow_value(101).for(:percentage) }
  it { is_expected.not_to allow_value(0).for(:percentage) }

  context 'to_s' do
    it 'should return person#to_s' do
      allow(subject).to receive_messages(person: double(to_s: 'Gabriel Sobrinho'))

      expect(subject.to_s).to eq 'Gabriel Sobrinho'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 spec/models/partner_spec.rb