Sha256: e32dcd5c35656628a8e7901fc144aa8cc3ca3da664995ab3c7edcaf15f86ff41

Contents?: true

Size: 1.26 KB

Versions: 13

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

class ContactTest < Zena::Unit::TestCase

  def test_user
    login(:anon)
    contact = secure!(Node) { nodes(:tiger) }
    assert user = contact.user
    assert_kind_of User, user
    assert_equal users_id(:tiger), user[:id]
  end

  def test_update_content
    login(:tiger)
    contact = secure!(Node) { nodes(:tiger) }
    assert_equal 'Panther', contact.c_first_name
    assert_equal 'Tigris Sumatran', contact.c_name
    c_id = contact.c_id
    v_id = contact.v_id
    assert contact.update_attributes(:c_first_name => 'Roger', :c_name => 'Rabbit', :v_status => Zena::Status[:pub])

    contact = secure!(Node) { nodes(:tiger) }
    assert_not_equal c_id, contact.c_id # new contact record
    assert_not_equal v_id, contact.v_id # new version record
    assert_equal 'Roger', contact.c_first_name
    assert_equal 'Rabbit', contact.c_name
    c_id = contact.c_id
    v_id = contact.v_id

    assert contact.update_attributes(:v_text => 'foo')

    contact = secure!(Node) { nodes(:tiger) }
    assert_equal c_id, contact.c_id # not a new contact record
    assert_not_equal v_id, contact.v_id # new version record
    assert_equal v_id, contact.v_content_id
    assert_equal 'Roger', contact.c_first_name
    assert_equal 'Rabbit', contact.c_name
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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