Sha256: d1206d1cb8d579cbc9bea61372a99a75040a0caa1a6dc81c08ed3620ebbb6971

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Pupa::Membership do
  let :object do
    Pupa::Membership.new({
      label: "Kitchen assistant at Joe's Diner",
      person_id: 'john-q-public',
      organization_id: 'abc-inc',
      post_id: 'abc-inc-kitchen-assistant',
      end_date: '1971-12-31',
    })
  end

  describe '#to_s' do
    it 'should return a human-readable string' do
      expect(object.to_s).to eq('john-q-public in abc-inc')
    end
  end

  describe '#fingerprint' do
    it 'should return the fingerprint' do
      expect(object.fingerprint).to eq({
        '$or' => [
          {label: "Kitchen assistant at Joe's Diner", person_id: 'john-q-public', organization_id: 'abc-inc', end_date: '1971-12-31'},
          {person_id: 'john-q-public', organization_id: 'abc-inc', post_id: 'abc-inc-kitchen-assistant', end_date: '1971-12-31'},
        ],
      })
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pupa-0.2.4 spec/models/membership_spec.rb
pupa-0.2.3 spec/models/membership_spec.rb
pupa-0.2.2 spec/models/membership_spec.rb
pupa-0.2.1 spec/models/membership_spec.rb
pupa-0.2.0 spec/models/membership_spec.rb