Class: AssociationColumnTest
- 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
- #setup ⇒ Object
- #test_association ⇒ Object
- #test_includes ⇒ Object
- #test_plurality ⇒ Object
- #test_searching ⇒ Object
- #test_sorting ⇒ Object
- #test_virtuality ⇒ Object
Instance Method Details
#setup ⇒ Object
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_association ⇒ Object
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_includes ⇒ Object
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_plurality ⇒ Object
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_searching ⇒ Object
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_sorting ⇒ Object
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_virtuality ⇒ Object
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 |