Sha256: 87a5f05d2bc511c9584c7f4c548e4850f5ff4ccca9e4701be1460440cf96f88e

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

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

class EltTest < Test::Unit::TestCase
  fixtures :people, :users, :elts, :mails, :attachments, :subscriptions

  def setup
    @elt = Elt.find(1)
  end

  def test_generated_id
		e = @elt.children.new
		e.subject = "\"Test: /de, ..  -\ #?&subject!\""
		e.body = "Test de body"
		e.save
		@elt.add_child e

		assert_equal "Test_de_subject", e.id

		e = @elt.children.new
		e.subject = "Test&? de subject"
		e.body = "Test de body"
		e.save
		@elt.add_child e

		assert_equal "Test_de_subject_1", e.id
  end

  def test_vote_hidden_from_view
		vote = @elt.children.new
		vote.save
		@elt.add_child vote
		vote.body = "+1"
		vote.publish

		assert_equal -1, vote.result
		assert_equal 1, vote.parent.result
  end

	def test_position
		e = @elt.children.new
		e.subject = "Test de position"
		e.body = "position: 3.0"
		e.save
		@elt.add_child e
		e.publish

		assert_equal 3, e.position
	end

	def test_last_activity
		e = @elt.children.new
		e.subject = "Test de position"
		e.body = "position: 3.0"
		e.save
		@elt.add_child e
		e.publish

		assert_equal e.created_on, e.last_activity
		assert_equal e.created_on, e.parent.last_activity
		assert_equal e.created_on, e.parent.parent.last_activity
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parlement-0.11 test/unit/elt_test.rb
parlement-0.12 test/unit/elt_test.rb
parlement-0.13 test/unit/elt_test.rb
parlement-0.14 test/unit/elt_test.rb