Commit e98b918f651ae503757db0fc4ef6406b5cd5337a

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 86284f8d

Adding unit tests for InvitationJob

(ActionItem1640)
Showing 1 changed file with 22 additions and 0 deletions   Show diff stats
test/unit/invitation_job_test.rb 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class InvitationJobTest < ActiveSupport::TestCase
  4 +
  5 + should 'invoke invitation' do
  6 + contact_list = ContactList.create!
  7 + person = create_user('maluquete').person
  8 + contacts_to_invite = ['email1@example.com', 'email2@example.com']
  9 +
  10 + job = InvitationJob.new(person.id, contacts_to_invite, 'Hi!', person.id, contact_list.id)
  11 +
  12 + Invitation.expects(:invite).with(person, contacts_to_invite, 'Hi!', person)
  13 + job.perform
  14 + end
  15 +
  16 + should 'handle errors correctly' do
  17 + assert_raise ActiveRecord::RecordNotFound do
  18 + InvitationJob.new(-1, [], 'Booo!', -1, -1).perform
  19 + end
  20 + end
  21 +
  22 +end
... ...