Class: Config::ListTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



4
5
6
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 4

def setup
  @config = ActiveScaffold::Config::Core.new :model_stub
end

#test_always_show_createObject



35
36
37
38
39
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 35

def test_always_show_create
  always_show_create = true
  @config.list.always_show_create = always_show_create
  assert_equal always_show_create, @config.list.always_show_create
end

#test_always_show_create_when_create_is_not_enabledObject



41
42
43
44
45
46
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 41

def test_always_show_create_when_create_is_not_enabled
  always_show_create = true
  @config.list.always_show_create = always_show_create
  @config.actions.exclude :create
  assert_equal false, @config.list.always_show_create
end

#test_always_show_searchObject



48
49
50
51
52
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 48

def test_always_show_search
  @config.list.always_show_search = true
  assert @config.list.always_show_search
  assert_equal 'search', @config.list.search_partial
end

#test_always_show_search_when_field_searchObject



60
61
62
63
64
65
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 60

def test_always_show_search_when_field_search
  @config.list.always_show_search = true
  @config.actions.swap :search, :live_search
  assert @config.list.always_show_search
  assert_equal 'live_search', @config.list.search_partial
end

#test_always_show_search_when_search_is_not_enabledObject



54
55
56
57
58
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 54

def test_always_show_search_when_search_is_not_enabled
  @config.list.always_show_search = true
  @config.actions.exclude :search
  assert_equal false, @config.list.always_show_search
end

#test_default_optionsObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 8

def test_default_options
  assert_equal 15, @config.list.per_page
  assert_equal '-', @config.list.empty_field_text
  assert @config.actions.include?(:search)
  assert_equal 'search', @config.list.search_partial
  assert_equal 'No Entries', @config.list.no_entries_message
  assert_equal 'Filtered List', @config.list.filtered_message
  assert !@config.list.always_show_create
  assert !@config.list.always_show_search
end

#test_filtered_messageObject



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

def test_filtered_message
  @config.list.filtered_message = 'filtered items'
  assert_equal 'filtered items', @config.list.filtered_message
end

#test_no_entriesObject



19
20
21
22
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 19

def test_no_entries
  @config.list.no_entries_message = 'No items'
  assert_equal 'No items', @config.list.no_entries_message
end

#test_per_pageObject



29
30
31
32
33
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/list_test.rb', line 29

def test_per_page
  per_page = 35
  @config.list.per_page = per_page
  assert_equal per_page, @config.list.per_page
end