Sha256: 0369763c0b8d255ceeecbccdab9a6c7b697f73111fcccd94905aba997a1a2767

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

require 'test_helper'

class DreadTest < ActiveSupport::TestCase

  test 'initialization' do
    assert_nothing_raised do
      dread_graph = Dread::Graph.new('user')
    end
  end

  test 'initialization with missing constant' do
    assert_raises Dread::Error do
      dread_graph = Dread::Graph.new('uzer')
    end
  end

  test 'various clazz names' do
    %w(account_setting
       AccountSetting
       account_settings
       AccountSettings).each do |model_name|
      assert_equal AccountSetting, Dread::Graph.new(model_name).clazz
    end
  end

  test 'drawing' do
    dread_graph = Dread::Graph.new('user')
    dread_graph.draw
  end

  test 'collecting' do
    dread_graph = Dread::Graph.new('user')
    dependable_collection = dread_graph.dependable_collection
    dependable_collection.assert_valid_keys(:user)
    dependable_collection[:user].assert_valid_keys(:tweets, :comments, :setting, :avatar)
    dependable_collection[:user][:tweets].assert_valid_keys(:comments, :pictures)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dread-0.0.6 test/dread_test.rb