Sha256: 486775fe5a6f86a327146c0b246e576f5a6ed717910325b1f5a564b83a55b8c7

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class ProjectTest < Zena::Unit::TestCase


  def test_project_id_on_create
    login(:tiger)
    node = secure!(Project) { Project.create(:parent_id=>nodes_id(:status), :name=>'SuperProject') }
    assert ! node.new_record?, 'Not a new record'
    assert_equal node[:id], node.get_project_id
    assert_equal nodes_id(:cleanWater), node[:project_id]
    child = secure!(Page) { Page.create(:parent_id=>node[:id], :name=>'child')}
    assert ! node.new_record?, "Not a new record"
    assert_equal node[:id], child[:project_id]
  end

  def test_update_set_project_id_on_update
    login(:tiger)
    node = secure!(Project) { Project.find(nodes_id(:cleanWater))}
    assert_equal nodes_id(:cleanWater), node.get_project_id
    node[:parent_id] = nodes_id(:zena)
    assert node.save, 'Can save node'
    node.reload
    assert_equal nodes_id(:cleanWater), node.get_project_id
    assert_equal nodes_id(:zena), node[:project_id]
    node[:project_id] = nodes_id(:zena)
    assert node.save, 'Can save node'
    node.reload
    assert_equal nodes_id(:cleanWater), node.get_project_id
    assert_equal nodes_id(:zena), node[:project_id]
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
zena-0.16.9 test/unit/project_test.rb
zena-0.16.8 test/unit/project_test.rb
zena-0.16.7 test/unit/project_test.rb
zena-0.16.6 test/unit/project_test.rb
zena-0.16.5 test/unit/project_test.rb
zena-0.16.4 test/unit/project_test.rb
zena-0.16.3 test/unit/project_test.rb
zena-0.16.2 test/unit/project_test.rb
zena-0.16.1 test/unit/project_test.rb
zena-0.16.0 test/unit/project_test.rb
zena-0.15.2 test/unit/project_test.rb
zena-0.15.1 test/unit/project_test.rb
zena-0.15.0 test/unit/project_test.rb