Sha256: 34b429ba7d05acbfd7694dd7cb25577b8f02859b80cfb1fb8e687aefd49fb141

Contents?: true

Size: 836 Bytes

Versions: 2

Compression:

Stored size: 836 Bytes

Contents

require 'abstract_unit'

class InvisibleModelAccessTest < Test::Unit::TestCase
  fixtures :fun_users, :groups, :group_memberships, :group_tag
  
  def setup
    @classes = [FunUser, Group, GroupMembership, GroupTag]
    @group = groups(:first)
  end
  
  def test_find
    @classes.each do |klass|
      assert_not_nil obj = klass.find(1)
      assert_equal klass, obj.class
    end
  end
  
  def test_create
    assert group = Group.create(:name => 'New Group')
    assert_equal Group, group.class
  end
  
  def test_update
    assert @group.update_attributes(:name => 'Group 1')
    assert_equal Group, @group.class
  end
  
  def test_delete
    assert @group.destroy
  end
  
  def test_validations
    group = Group.new
    assert !group.valid?
    assert_not_nil group.errors[:name]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dr_nic_magic_models-0.7.0 test/invisible_model_access_test.rb
dr_nic_magic_models-0.7.1 test/invisible_model_access_test.rb