Sha256: a31a7baba670f603954f91709e3a536037173273aa33cff0753ffb80d6dfee7a

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class SectionTest < Zena::Unit::TestCase


  def test_section_id_on_create
    login(:tiger)
    node = secure!(Section) { Section.create(:parent_id=>nodes_id(:status), :name=>'SuperSection') }
    assert ! node.new_record?, 'Not a new record'
    assert_equal node[:id], node.get_section_id
    assert_equal nodes_id(:zena), node[:section_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[:section_id]
  end

  def test_update_set_section_id_on_update
    login(:tiger)
    node = secure!(Section) { Section.find(nodes_id(:people))}
    assert_equal nodes_id(:people), node.get_section_id
    node[:parent_id] = nodes_id(:zena)
    assert node.save, 'Can save node'
    node.reload
    assert_equal nodes_id(:people), node.get_section_id
    assert_equal nodes_id(:zena), node[:section_id]
    node[:section_id] = nodes_id(:zena)
    assert node.save, 'Can save node'
    node.reload
    assert_equal nodes_id(:people), node.get_section_id
    assert_equal nodes_id(:zena), node[:section_id]
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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