Sha256: 33324c25f4628797bcbe9669dfc27cda0546ec7ca1a73e92f2f6a9b2b9ae53a8

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Lifen::Communication::Request do

  let(:channel)             { Lifen::Communication::Channel.new(uuid: "valid_channel_uuid", type: "address") } #valid_channel_uuid

  let(:sender)              { Lifen::User.new(uuid: "valid_sender_uuid") } #valid_sender_uuid
  let(:recipient)           { Lifen::User.new(uuid: "valid_recipient_uuid") } #valid_recipient_uuid

  let(:attachment)          { Lifen::Communication::Attachment.new(title: "Master Plan", path: File.dirname(__FILE__) + "/support/master_plan.pdf", content_type: "application/pdf") }

  let(:patient)             { Lifen::Communication::Patient.new(first_name: "Jean", last_name: "Dupond", birthdate: Date.new(2000,1,1)) }


  describe ':send' do

    let(:request)           { Lifen::Communication::Request.new(sender: sender, recipient: recipient, channel: channel, attachment: attachment, patient: patient) }

    it 'works' do
      VCR.use_cassette "request/send/valid_attributes" do
        request.send
      end

      expect(request.uuid).to_not be_nil
    end

    context 'invalid channel' do

      let(:channel)             { Lifen::Communication::Channel.new(uuid: nil) }

      it 'raises an error' do
        expect{
          request.send
        }.to raise_error Lifen::Error, "Invalid channel: an UUID is required"
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lifen-1.6.8 spec/requests_spec.rb
lifen-1.6.7 spec/requests_spec.rb