Module: CrudTestHelper

Included in:
CrudTestModelsControllerTest, CustomAssertionsTest, DryCrud::Form::BuilderTest, FormHelperTest, FormatHelperTest, I18nHelperTest, TableHelperTest, UtilityHelperTest
Defined in:
lib/generators/dry_crud/templates/test/support/crud_test_helper.rb

Overview

A simple test helper to prepare the test database with a CrudTestModel model. This helper is used to test the CrudController and various helpers without the need for an application based model.

Instance Method Summary collapse

Instance Method Details

#action_nameObject



22
23
24
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 22

def action_name
  'index'
end

#controller_nameObject



18
19
20
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 18

def controller_name
  'crud_test_models'
end

#h(text) ⇒ Object



38
39
40
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 38

def h(text)
  ERB::Util.h(text)
end

#model_classObject

Controller helper methods for the tests



14
15
16
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 14

def model_class
  CrudTestModel
end

#paramsObject



26
27
28
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 26

def params
  {}
end

#path_args(entry) ⇒ Object



30
31
32
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 30

def path_args(entry)
  entry
end

#sortable?(_attr) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/generators/dry_crud/templates/test/support/crud_test_helper.rb', line 34

def sortable?(_attr)
  true
end