Sha256: 1ce99898f8d8de49d33856b1820a43f6ffd34cb9466fe7948d0763ae359779e0

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe SendEmailTo do
  let(:session) { Sessions::BasicAuthSession.new }
  before { allow(Sessions::BasicAuthSession).to receive(:new).and_return session }

  it 'performs a post on the emails api path providing the person_id and the email attributes' do
    email_attributes = {subject: 'some_subject',
                        body: 'some_body',
                        content_type: 'some/content/type',
                        mail_type: 'some_mail_type'}
    expect(session).to receive(:post).with '/emails', person_id: 'some_person_id', email: email_attributes
    SendEmailTo.run!(person_id: 'some_person_id', attributes: email_attributes)
  end

  it 'defaults the content_type to text/html' do
    email_attributes = {subject: 'some_subject',
                        body: 'some_body',
                        mail_type: 'some_mail_type'}
    expect(session).to receive(:post).with '/emails', person_id: 'some_person_id',
                                                      email: email_attributes.merge(content_type: 'text/html')
    SendEmailTo.run!(person_id: 'some_person_id', attributes: email_attributes)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roqua-core-api-0.7.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.6.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.5.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.4.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.3.1 spec/lib/roqua/core_api/send_email_to_spec.rb