Class: AssociationColumnTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb

Overview

require ‘test/model_stub’

Instance Method Summary collapse

Instance Method Details

#setupObject



5
6
7
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 5

def setup
  @association_column = ActiveScaffold::DataStructures::Column.new('other_model', ModelStub)
end

#test_associationObject



25
26
27
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 25

def test_association
  assert @association_column.association.is_a?(ActiveRecord::Reflection::AssociationReflection)
end

#test_includesObject



29
30
31
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 29

def test_includes
  assert_equal [:other_model], @association_column.includes
end

#test_pluralityObject



33
34
35
36
37
38
39
40
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 33

def test_plurality
  assert @association_column.singular_association?
  assert !@association_column.plural_association?

  plural_association_column = ActiveScaffold::DataStructures::Column.new('other_models', ModelStub)
  assert plural_association_column.plural_association?
  assert !plural_association_column.singular_association?
end

#test_searchingObject



20
21
22
23
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 20

def test_searching
  # right now, there's no intelligent searching on association columns
  assert !@association_column.searchable?
end

#test_sortingObject



14
15
16
17
18
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 14

def test_sorting
  # sorting on association columns is method-based
  hash = {:method => "other_model.to_s"}
  assert_equal hash, @association_column.sort
end

#test_virtualityObject



9
10
11
12
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/association_column_test.rb', line 9

def test_virtuality
  assert @association_column.association
  assert !@association_column.virtual?
end