Sha256: 4d6484566be0db6baaf4e1dc8b8e738beba8700b330946006e8da0fb6e84f9aa

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class SubscriberTest < Test::Unit::TestCase
  fixtures :people, :users, :elts, :mails, :attachments, :subscribers

  def setup
		@elt = Elt.find('mail')
		@person = Person.find('first')
  end

  def test_add_subscriber
		num = @elt.subscribers.size
		@elt.subscribers << Person.find('bob')
		assert_equal (num + 1), @elt.subscribers.size
  end

  def test_delete_subscriber
		num = @elt.subscribers.size
		@elt.subscribers.delete(@person)
		assert_equal (num - 1), @elt.subscribers.size
  end

	def test_add_subscribed_elt
		num = @person.subscribed_elts.size
		@person.subscribed_elts << Elt.find('0')
		assert_equal (num + 1), @person.subscribed_elts.size
  end

  def test_delete_subscribed_elt
		num = @person.subscribed_elts.size
		@person.subscribed_elts.delete(@elt)
		assert_equal (num - 1), @person.subscribed_elts.size
  end

  def test_all_recipients
		num = @elt.all_recipients.size
		@elt.subscribers << Person.find('bob')
		@elt.parent.subscribers << Person.find('bob2')
		assert_equal (num + 2), @elt.all_recipients.size
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
parlement-0.5 test/unit/subscriber_test.rb
parlement-0.6 test/unit/subscriber_test.rb
parlement-0.7 test/unit/subscriber_test.rb
parlement-0.8 test/unit/subscriber_test.rb
parlement-0.9 test/unit/subscriber_test.rb