Sha256: 87e542034deab3fd1fcf3c272da2c1b626384d4f254f0cb1c62b83027c73091f

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

describe SendInviteEmail do
  let(:session) { Fabricate :roqua_core_api_oauth_session }

  context 'Dossier' do
    subject { SendInviteEmail.run! \
                session: session,
                dossier_id: 'some_dossier_id',
                email_subject: 'account created',
                email_body: 'visit %create_account_link% to set password' }
    it 'performs a post on the send_invite_email api path' do
      expect(session).to receive(:post).with '/dossiers/some_dossier_id/send_invite_email',
                                             email_subject: 'account created',
                                             email_body: 'visit %create_account_link% to set password'
      subject
    end
  end

  context "Person" do
    subject { SendInviteEmail.run! \
                session: session,
                person_id: 'some_person_id',
                email_subject: 'account created',
                email_body: 'visit %create_account_link% to set password' }
    it 'performs a post on the send_invite_email api path' do
      expect(session).to receive(:post).with '/people/some_person_id/send_invite_email',
                                             email_subject: 'account created',
                                             email_body: 'visit %create_account_link% to set password'
      subject
    end
  end

  context "Neither Dossier nor Person" do
    subject { SendInviteEmail.run \
                session: session,
                email_subject: 'account created',
                email_body: 'visit %create_account_link% to set password' }

    it 'performs a post on the send_invite_email api path' do
      expect(subject).to be_invalid
      expect(subject.errors).to include :person_id
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roqua-core-api-0.3.1 spec/lib/roqua/core_api/send_invite_email_spec.rb
roqua-core-api-0.3.0 spec/lib/roqua/core_api/send_invite_email_spec.rb
roqua-core-api-0.2.4 spec/lib/roqua/core_api/send_invite_email_spec.rb
roqua-core-api-0.2.3 spec/lib/roqua/core_api/send_invite_email_spec.rb
roqua-core-api-0.2.2 spec/lib/roqua/core_api/send_invite_email_spec.rb
roqua-core-api-0.2.1 spec/lib/roqua/core_api/send_invite_email_spec.rb