Sha256: 35a81e91e6aa0b17824c8fb9b09f4ad60246759714212321a89f11b7eadc9f3d

Contents?: true

Size: 983 Bytes

Versions: 8

Compression:

Stored size: 983 Bytes

Contents

require 'spec_helper'
require 'flapjack/data/message'

describe Flapjack::Data::Message do

  let(:contact) { double(Flapjack::Data::Contact) }

  it "assigns itself an ID" do
    message = Flapjack::Data::Message.for_contact(contact)
    mid = message.id
    mid.should_not be_nil
    mid.should be_a(String)
  end

  it "returns its contained data" do
    message = Flapjack::Data::Message.for_contact(contact, :medium => 'email',
                :address => 'jja@example.com')

    contact.should_receive(:id).and_return('23')
    contact.should_receive(:first_name).and_return('James')
    contact.should_receive(:last_name).and_return('Jameson')

    message.contents.should include('contact_id' => '23',
                                    'contact_first_name' => 'James',
                                    'contact_last_name' => 'Jameson',
                                    'media' => 'email',
                                    'address' => 'jja@example.com')
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flapjack-0.7.35 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.34 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.33 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.32 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.31 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.30 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.29 spec/lib/flapjack/data/message_spec.rb
flapjack-0.7.28 spec/lib/flapjack/data/message_spec.rb