Sha256: 308bd01eca883c7aec4ddf831db82d442420ce586e5a29d2516f9de8a8ed4258

Contents?: true

Size: 1.21 KB

Versions: 35

Compression:

Stored size: 1.21 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',
                        bcc: 'some@bcc',
                        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',
                        bcc: 'some@bcc',
                        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

35 entries across 35 versions & 1 rubygems

Version Path
roqua-core-api-0.3.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.2.4 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.2.3 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.2.2 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.2.1 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.2.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.1.1 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.1.0 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.39 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.38 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.37 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.36 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.35 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.32 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.31 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.30 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.29 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.28 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.27 spec/lib/roqua/core_api/send_email_to_spec.rb
roqua-core-api-0.0.26 spec/lib/roqua/core_api/send_email_to_spec.rb