Sha256: 428fa5168fe623e0eaad9a3edf6640533ea5d8e7478f5eedebbbb1f001763a59

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

class Dread::MissingGraphTest < ActiveSupport::TestCase

  test 'initializaties with no problems' do
    assert_nothing_raised do
      Dread::MissingGraph.new('user')
    end
  end

  test 'user class has no missing dependables' do
    missing_dependables = Dread::MissingGraph.new('user').missing_dependables
    assert_equal [], missing_dependables
  end

  test 'account settings class has no missing dependables' do
    missing_dependables = Dread::MissingGraph.new('account_setting').missing_dependables
    assert_equal [], missing_dependables
  end

  test 'can find the model for multiple kinds of notations' do
    %w(account_setting
       AccountSetting).each do |model_name|
      assert_equal AccountSetting, Dread::MissingGraph.new(model_name).clazz
    end
  end

  test 'can find the model for various namespaced clazz names' do
    %w(Wtf::Ashtray
       wtf/ashtray).each do |model_name|
      assert_equal Wtf::Ashtray, Dread::MissingGraph.new(model_name).clazz
    end
  end

  test 'company class has missing dependables on company_organization and headquarter' do
    missing_dependables = Dread::MissingGraph.new('company').missing_dependables
    assert_equal [:company_organizations, :headquarter], missing_dependables
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dread-0.1.0 test/missing_graph_test.rb