active_scaffold 3.4.17 → 3.4.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +12 -1
  3. data/README.md +8 -4
  4. data/app/assets/javascripts/jquery/active_scaffold.js +82 -67
  5. data/app/assets/stylesheets/active_scaffold.scss +1 -1
  6. data/app/assets/stylesheets/active_scaffold_colors.scss +1 -1
  7. data/app/assets/stylesheets/blue-theme.css +1 -1
  8. data/app/views/active_scaffold_overrides/_form_association.html.erb +3 -3
  9. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +3 -3
  10. data/app/views/active_scaffold_overrides/_show_columns.html.erb +1 -1
  11. data/lib/active_scaffold.rb +16 -16
  12. data/lib/active_scaffold/actions/common_search.rb +13 -11
  13. data/lib/active_scaffold/actions/core.rb +85 -78
  14. data/lib/active_scaffold/actions/create.rb +29 -28
  15. data/lib/active_scaffold/actions/delete.rb +17 -17
  16. data/lib/active_scaffold/actions/field_search.rb +18 -19
  17. data/lib/active_scaffold/actions/list.rb +30 -22
  18. data/lib/active_scaffold/actions/mark.rb +1 -1
  19. data/lib/active_scaffold/actions/nested.rb +78 -65
  20. data/lib/active_scaffold/actions/search.rb +13 -10
  21. data/lib/active_scaffold/actions/show.rb +10 -6
  22. data/lib/active_scaffold/actions/subform.rb +1 -2
  23. data/lib/active_scaffold/actions/update.rb +39 -31
  24. data/lib/active_scaffold/active_record_permissions.rb +14 -15
  25. data/lib/active_scaffold/attribute_params.rb +42 -43
  26. data/lib/active_scaffold/bridges.rb +22 -12
  27. data/lib/active_scaffold/bridges/ancestry.rb +1 -1
  28. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +6 -6
  29. data/lib/active_scaffold/bridges/bitfields.rb +1 -1
  30. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -13
  31. data/lib/active_scaffold/bridges/calendar_date_select.rb +5 -5
  32. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +17 -20
  33. data/lib/active_scaffold/bridges/cancan.rb +1 -1
  34. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +8 -9
  35. data/lib/active_scaffold/bridges/carrierwave.rb +4 -4
  36. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +9 -8
  37. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +11 -10
  38. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +7 -6
  39. data/lib/active_scaffold/bridges/chosen.rb +1 -1
  40. data/lib/active_scaffold/bridges/chosen/helpers.rb +4 -4
  41. data/lib/active_scaffold/bridges/country_helper.rb +1 -1
  42. data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +259 -260
  43. data/lib/active_scaffold/bridges/date_picker.rb +2 -2
  44. data/lib/active_scaffold/bridges/date_picker/ext.rb +9 -11
  45. data/lib/active_scaffold/bridges/date_picker/helper.rb +61 -67
  46. data/lib/active_scaffold/bridges/dragonfly.rb +4 -4
  47. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +9 -8
  48. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +11 -10
  49. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +6 -5
  50. data/lib/active_scaffold/bridges/file_column.rb +5 -5
  51. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +20 -23
  52. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +20 -23
  53. data/lib/active_scaffold/bridges/file_column/form_ui.rb +13 -14
  54. data/lib/active_scaffold/bridges/file_column/list_ui.rb +7 -8
  55. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +18 -22
  56. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +5 -4
  57. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +2 -10
  58. data/lib/active_scaffold/bridges/paper_trail.rb +7 -5
  59. data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +4 -3
  60. data/lib/active_scaffold/bridges/paperclip.rb +5 -5
  61. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +11 -10
  62. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +6 -5
  63. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +10 -9
  64. data/lib/active_scaffold/bridges/record_select.rb +1 -1
  65. data/lib/active_scaffold/bridges/record_select/helpers.rb +28 -28
  66. data/lib/active_scaffold/bridges/semantic_attributes.rb +1 -1
  67. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +1 -1
  68. data/lib/active_scaffold/bridges/shared/date_bridge.rb +58 -52
  69. data/lib/active_scaffold/bridges/tiny_mce.rb +2 -2
  70. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -3
  71. data/lib/active_scaffold/config/base.rb +9 -10
  72. data/lib/active_scaffold/config/core.rb +24 -29
  73. data/lib/active_scaffold/config/create.rb +0 -1
  74. data/lib/active_scaffold/config/field_search.rb +8 -10
  75. data/lib/active_scaffold/config/form.rb +5 -5
  76. data/lib/active_scaffold/config/list.rb +21 -20
  77. data/lib/active_scaffold/config/mark.rb +3 -3
  78. data/lib/active_scaffold/config/nested.rb +11 -10
  79. data/lib/active_scaffold/config/search.rb +2 -3
  80. data/lib/active_scaffold/config/show.rb +1 -1
  81. data/lib/active_scaffold/config/update.rb +1 -2
  82. data/lib/active_scaffold/configurable.rb +9 -11
  83. data/lib/active_scaffold/constraints.rb +9 -8
  84. data/lib/active_scaffold/core.rb +72 -84
  85. data/lib/active_scaffold/data_structures/action_columns.rb +26 -25
  86. data/lib/active_scaffold/data_structures/action_link.rb +43 -43
  87. data/lib/active_scaffold/data_structures/action_links.rb +17 -15
  88. data/lib/active_scaffold/data_structures/actions.rb +5 -5
  89. data/lib/active_scaffold/data_structures/bridge.rb +6 -3
  90. data/lib/active_scaffold/data_structures/column.rb +110 -89
  91. data/lib/active_scaffold/data_structures/columns.rb +3 -3
  92. data/lib/active_scaffold/data_structures/error_message.rb +4 -6
  93. data/lib/active_scaffold/data_structures/nested_info.rb +43 -48
  94. data/lib/active_scaffold/data_structures/set.rb +7 -8
  95. data/lib/active_scaffold/data_structures/sorting.rb +38 -33
  96. data/lib/active_scaffold/delayed_setup.rb +5 -6
  97. data/lib/active_scaffold/engine.rb +4 -4
  98. data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -4
  99. data/lib/active_scaffold/extensions/action_controller_rescueing.rb +1 -1
  100. data/lib/active_scaffold/extensions/action_view_rendering.rb +5 -6
  101. data/lib/active_scaffold/extensions/left_outer_joins.rb +11 -11
  102. data/lib/active_scaffold/extensions/localize.rb +1 -1
  103. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +1 -1
  104. data/lib/active_scaffold/extensions/paginator_extensions.rb +2 -5
  105. data/lib/active_scaffold/extensions/reverse_associations.rb +13 -13
  106. data/lib/active_scaffold/extensions/routing_mapper.rb +9 -9
  107. data/lib/active_scaffold/extensions/unsaved_associated.rb +9 -9
  108. data/lib/active_scaffold/finder.rb +90 -93
  109. data/lib/active_scaffold/helpers/association_helpers.rb +5 -5
  110. data/lib/active_scaffold/helpers/controller_helpers.rb +22 -19
  111. data/lib/active_scaffold/helpers/form_column_helpers.rb +115 -105
  112. data/lib/active_scaffold/helpers/human_condition_helpers.rb +62 -35
  113. data/lib/active_scaffold/helpers/id_helpers.rb +6 -6
  114. data/lib/active_scaffold/helpers/list_column_helpers.rb +89 -94
  115. data/lib/active_scaffold/helpers/pagination_helpers.rb +9 -9
  116. data/lib/active_scaffold/helpers/search_column_helpers.rb +47 -44
  117. data/lib/active_scaffold/helpers/show_column_helpers.rb +2 -2
  118. data/lib/active_scaffold/helpers/view_helpers.rb +86 -91
  119. data/lib/active_scaffold/marked_model.rb +10 -10
  120. data/lib/active_scaffold/paginator.rb +30 -34
  121. data/lib/active_scaffold/responds_to_parent.rb +27 -28
  122. data/lib/active_scaffold/tableless.rb +20 -15
  123. data/lib/active_scaffold/version.rb +1 -1
  124. data/lib/generators/active_scaffold/active_scaffold_generator.rb +8 -8
  125. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +9 -9
  126. data/shoulda_macros/macros.rb +27 -22
  127. data/test/bridges/bridge_test.rb +38 -29
  128. data/test/bridges/date_picker_test.rb +1 -1
  129. data/test/bridges/paper_trail_test.rb +17 -0
  130. data/test/bridges/paperclip_test.rb +3 -2
  131. data/test/bridges/tiny_mce_test.rb +5 -2
  132. data/test/company.rb +25 -30
  133. data/test/config/base_test.rb +1 -1
  134. data/test/config/core_test.rb +9 -9
  135. data/test/config/create_test.rb +14 -8
  136. data/test/config/delete_test.rb +4 -4
  137. data/test/config/field_search_test.rb +6 -6
  138. data/test/config/list_test.rb +16 -16
  139. data/test/config/nested_test.rb +4 -4
  140. data/test/config/search_test.rb +8 -8
  141. data/test/config/show_test.rb +6 -6
  142. data/test/config/subform_test.rb +1 -1
  143. data/test/config/update_test.rb +5 -5
  144. data/test/const_mocker.rb +4 -4
  145. data/test/data_structures/action_columns_test.rb +4 -5
  146. data/test/data_structures/action_link_test.rb +1 -0
  147. data/test/data_structures/action_links_test.rb +5 -5
  148. data/test/data_structures/column_test.rb +9 -9
  149. data/test/data_structures/columns_test.rb +2 -2
  150. data/test/data_structures/error_message_test.rb +4 -5
  151. data/test/data_structures/set_test.rb +1 -2
  152. data/test/data_structures/sorting_test.rb +10 -10
  153. data/test/data_structures/validation_reflection_test.rb +8 -0
  154. data/test/extensions/routing_mapper_test.rb +2 -2
  155. data/test/helpers/list_column_helpers_test.rb +3 -2
  156. data/test/helpers/pagination_helpers_test.rb +5 -4
  157. data/test/helpers/search_column_helpers_test.rb +1 -1
  158. data/test/misc/active_record_permissions_test.rb +63 -50
  159. data/test/misc/attribute_params_test.rb +28 -26
  160. data/test/misc/calculation_test.rb +10 -3
  161. data/test/misc/configurable_test.rb +12 -13
  162. data/test/misc/constraints_test.rb +6 -6
  163. data/test/misc/convert_numbers_format_test.rb +7 -6
  164. data/test/misc/finder_test.rb +17 -12
  165. data/test/misc/lang_test.rb +3 -4
  166. data/test/misc/tableless_test.rb +2 -3
  167. data/test/mock_app/app/controllers/addresses_controller.rb +1 -1
  168. data/test/mock_app/app/controllers/buildings_controller.rb +1 -1
  169. data/test/mock_app/app/controllers/cars_controller.rb +1 -1
  170. data/test/mock_app/app/controllers/contacts_controller.rb +1 -1
  171. data/test/mock_app/app/controllers/people_controller.rb +1 -1
  172. data/test/mock_app/app/models/file_model.rb +2 -2
  173. data/test/mock_app/app/models/person.rb +1 -1
  174. data/test/mock_app/config/application.rb +3 -3
  175. data/test/mock_app/config/boot.rb +1 -1
  176. data/test/mock_app/config/environment.rb +1 -0
  177. data/test/mock_app/config/environments/development.rb +0 -1
  178. data/test/mock_app/config/environments/production.rb +1 -1
  179. data/test/mock_app/db/schema.rb +14 -15
  180. data/test/model_stub.rb +13 -16
  181. data/test/run_all.rb +5 -7
  182. data/test/test_helper.rb +12 -9
  183. metadata +19 -3
@@ -6,15 +6,21 @@ module Config
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.create.link
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  @config.create.link = @default_link
12
12
  end
13
-
13
+
14
14
  def test_default_options
15
15
  refute @config.create.persistent
16
16
  assert @config.create.action_after_create.nil?
17
17
  assert_equal 'Create Model stub', @config.create.label
18
+ assert @config.columns[:b].required?
19
+ end
20
+
21
+ def test_override_required
22
+ @config.configure { |conf| conf.columns[:b].required = false }
23
+ refute @config.columns[:b].required?
18
24
  end
19
25
 
20
26
  def test_link_defaults
@@ -22,8 +28,8 @@ module Config
22
28
  refute link.page?
23
29
  refute link.popup?
24
30
  refute link.confirm?
25
- assert_equal "new", link.action
26
- assert_equal "Create New", link.label
31
+ assert_equal 'new', link.action
32
+ assert_equal 'Create New', link.label
27
33
  assert link.inline?
28
34
  blank = {}
29
35
  assert_equal blank, link.html_options
@@ -32,12 +38,12 @@ module Config
32
38
  assert_equal :create, link.crud_type
33
39
  assert_equal :create_authorized?, link.security_method
34
40
  end
35
-
41
+
36
42
  def test_setting_link
37
43
  @config.create.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
38
44
  refute_equal @default_link, @config.create.link
39
45
  end
40
-
46
+
41
47
  def test_label
42
48
  label = 'create new monkeys'
43
49
  @config.create.label = label
@@ -46,12 +52,12 @@ module Config
46
52
  @config.create.label = :create_new_model
47
53
  assert_equal 'Create new Model stub', @config.create.label
48
54
  end
49
-
55
+
50
56
  def test_persistent
51
57
  @config.create.persistent = true
52
58
  assert @config.create.persistent
53
59
  end
54
-
60
+
55
61
  def test_action_after_create
56
62
  @config.create.action_after_create = :edit
57
63
  assert_equal :edit, @config.create.action_after_create
@@ -6,7 +6,7 @@ module Config
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.delete.link
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  @config.delete.link = @default_link
12
12
  end
@@ -16,8 +16,8 @@ module Config
16
16
  refute link.page?
17
17
  refute link.popup?
18
18
  assert link.confirm?
19
- assert_equal "destroy", link.action
20
- assert_equal "Delete", link.label
19
+ assert_equal 'destroy', link.action
20
+ assert_equal 'Delete', link.label
21
21
  assert link.inline?
22
22
  blank = {}
23
23
  assert_equal blank, link.html_options
@@ -26,7 +26,7 @@ module Config
26
26
  assert_equal :delete, link.crud_type
27
27
  assert_equal :delete_authorized?, link.security_method
28
28
  end
29
-
29
+
30
30
  def test_setting_link
31
31
  @config.delete.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
32
32
  refute_equal @default_link, @config.delete.link
@@ -7,15 +7,15 @@ module Config
7
7
  @config.actions.swap :search, :field_search
8
8
  @default_link = @config.field_search.link
9
9
  end
10
-
10
+
11
11
  def teardown
12
12
  @config.field_search.link = @default_link
13
13
  end
14
-
14
+
15
15
  def test_default_options
16
16
  assert_equal :full, @config.field_search.text_search
17
17
  end
18
-
18
+
19
19
  def test_text_search
20
20
  @config.field_search.text_search = :start
21
21
  assert_equal :start, @config.field_search.text_search
@@ -30,8 +30,8 @@ module Config
30
30
  refute link.page?
31
31
  refute link.popup?
32
32
  refute link.confirm?
33
- assert_equal "show_search", link.action
34
- assert_equal "Search", link.label
33
+ assert_equal 'show_search', link.action
34
+ assert_equal 'Search', link.label
35
35
  assert link.inline?
36
36
  blank = {}
37
37
  assert_equal blank, link.html_options
@@ -40,7 +40,7 @@ module Config
40
40
  assert_equal :read, link.crud_type
41
41
  assert_equal :search_authorized?, link.security_method
42
42
  end
43
-
43
+
44
44
  def test_setting_link
45
45
  @config.field_search.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
46
46
  refute_equal @default_link, @config.field_search.link
@@ -31,40 +31,40 @@ module Config
31
31
  assert @config.list.sorting.sorts_on?(:id)
32
32
  assert_equal 'ASC', @config.list.sorting.direction_of(:id)
33
33
  end
34
-
34
+
35
35
  def test_empty_field_text
36
36
  @config.list.empty_field_text = '(missing)'
37
37
  assert_equal '(missing)', @config.list.empty_field_text
38
38
  end
39
-
39
+
40
40
  def test_association_join_text
41
41
  @config.list.association_join_text = '<br/>'
42
42
  assert_equal '<br/>', @config.list.association_join_text
43
43
  end
44
-
44
+
45
45
  def test_no_entries
46
46
  @config.list.no_entries_message = 'No items'
47
47
  assert_equal 'No items', @config.list.no_entries_message
48
48
  end
49
-
49
+
50
50
  def test_filtered_message
51
51
  @config.list.filtered_message = 'filtered items'
52
52
  assert_equal 'filtered items', @config.list.filtered_message
53
53
  end
54
-
54
+
55
55
  def test_pagination
56
56
  @config.list.pagination = :infinite
57
57
  assert_equal :infinite, @config.list.pagination
58
58
  @config.list.pagination = false
59
59
  refute @config.list.pagination
60
60
  end
61
-
61
+
62
62
  def test_sorting
63
63
  @config.list.sorting = {:a => :desc}
64
64
  assert @config.list.sorting.sorts_on?(:a)
65
65
  assert_equal 'DESC', @config.list.sorting.direction_of(:a)
66
66
  refute @config.list.sorting.sorts_on?(:id)
67
-
67
+
68
68
  @config.list.sorting = {:c => :asc, :d => :desc}
69
69
  assert @config.list.sorting.sorts_on?(:c)
70
70
  assert_equal 'ASC', @config.list.sorting.direction_of(:c)
@@ -72,7 +72,7 @@ module Config
72
72
  assert_equal 'DESC', @config.list.sorting.direction_of(:d)
73
73
  refute @config.list.sorting.sorts_on?(:a)
74
74
  refute @config.list.sorting.sorts_on?(:id)
75
-
75
+
76
76
  @config.list.sorting = [{:a => :asc}, {:b => :desc}]
77
77
  assert @config.list.sorting.sorts_on?(:a)
78
78
  assert_equal 'ASC', @config.list.sorting.direction_of(:a)
@@ -81,51 +81,51 @@ module Config
81
81
  refute @config.list.sorting.sorts_on?(:c)
82
82
  refute @config.list.sorting.sorts_on?(:id)
83
83
  end
84
-
84
+
85
85
  def test_per_page
86
86
  per_page = 35
87
87
  @config.list.per_page = per_page
88
88
  assert_equal per_page, @config.list.per_page
89
89
  end
90
-
90
+
91
91
  def test_page_links_window
92
92
  page_links_window = 3
93
93
  @config.list.page_links_inner_window = page_links_window
94
94
  assert_equal page_links_window, @config.list.page_links_inner_window
95
95
  end
96
-
96
+
97
97
  def test_always_show_create
98
98
  always_show_create = true
99
99
  @config.list.always_show_create = always_show_create
100
100
  assert_equal always_show_create, @config.list.always_show_create
101
101
  end
102
-
102
+
103
103
  def test_always_show_create_when_create_is_not_enabled
104
104
  always_show_create = true
105
105
  @config.list.always_show_create = always_show_create
106
106
  @config.actions.exclude :create
107
107
  assert_equal false, @config.list.always_show_create
108
108
  end
109
-
109
+
110
110
  def test_always_show_search
111
111
  @config.list.always_show_search = true
112
112
  assert @config.list.always_show_search
113
113
  assert_equal 'search', @config.list.search_partial
114
114
  end
115
-
115
+
116
116
  def test_always_show_search_when_search_is_not_enabled
117
117
  @config.list.always_show_search = true
118
118
  @config.actions.exclude :search
119
119
  assert_equal false, @config.list.always_show_search
120
120
  end
121
-
121
+
122
122
  def test_always_show_search_when_field_search
123
123
  @config.list.always_show_search = true
124
124
  @config.actions.swap :search, :field_search
125
125
  assert @config.list.always_show_search
126
126
  assert_equal 'field_search', @config.list.search_partial
127
127
  end
128
-
128
+
129
129
  def test_count_includes
130
130
  @config.list.count_includes = [:assoc_1, :assoc_2]
131
131
  assert_equal [:assoc_1, :assoc_2], @config.list.count_includes
@@ -10,12 +10,12 @@ module Config
10
10
  def setup
11
11
  @config = ActiveScaffold::Config::Core.new(:model_stub)
12
12
  end
13
-
13
+
14
14
  def test_default_options
15
15
  assert @config.nested.shallow_delete
16
16
  assert_equal 'Add Existing Model stub', @config.nested.label
17
17
  end
18
-
18
+
19
19
  def test_label
20
20
  label = 'nested monkeys'
21
21
  @config.nested.label = label
@@ -24,12 +24,12 @@ module Config
24
24
  @config.nested.label = :test_create_model
25
25
  assert_equal 'Add new Model stub', @config.nested.label
26
26
  end
27
-
27
+
28
28
  def test_shallow_delete
29
29
  @config.nested.shallow_delete = true
30
30
  assert @config.nested.shallow_delete
31
31
  end
32
-
32
+
33
33
  def test_add_link
34
34
  assert_raises(ArgumentError) { @config.nested.add_link :assoc_1 }
35
35
  config = @config
@@ -6,17 +6,17 @@ module Config
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.search.link
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  @config.search.link = @default_link
12
12
  end
13
-
13
+
14
14
  def test_default_options
15
15
  assert_equal :full, @config.search.text_search
16
16
  refute @config.search.live?
17
17
  assert_equal ' ', @config.search.split_terms
18
18
  end
19
-
19
+
20
20
  def test_text_search
21
21
  @config.search.text_search = :start
22
22
  assert_equal :start, @config.search.text_search
@@ -25,12 +25,12 @@ module Config
25
25
  @config.search.text_search = false
26
26
  refute @config.search.text_search
27
27
  end
28
-
28
+
29
29
  def test_live
30
30
  @config.search.live = true
31
31
  assert @config.search.live?
32
32
  end
33
-
33
+
34
34
  def test_split_terms
35
35
  @config.search.split_terms = nil
36
36
  assert @config.search.split_terms.nil?
@@ -43,8 +43,8 @@ module Config
43
43
  refute link.page?
44
44
  refute link.popup?
45
45
  refute link.confirm?
46
- assert_equal "show_search", link.action
47
- assert_equal "Search", link.label
46
+ assert_equal 'show_search', link.action
47
+ assert_equal 'Search', link.label
48
48
  assert link.inline?
49
49
  blank = {}
50
50
  assert_equal blank, link.html_options
@@ -53,7 +53,7 @@ module Config
53
53
  assert_equal :read, link.crud_type
54
54
  assert_equal :search_authorized?, link.security_method
55
55
  end
56
-
56
+
57
57
  def test_setting_link
58
58
  @config.search.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
59
59
  refute_equal @default_link, @config.search.link
@@ -6,18 +6,18 @@ module Config
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.show.link
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  @config.show.link = @default_link
12
12
  end
13
-
13
+
14
14
  def test_link_defaults
15
15
  link = @config.show.link
16
16
  refute link.page?
17
17
  refute link.popup?
18
18
  refute link.confirm?
19
- assert_equal "show", link.action
20
- assert_equal "Show", link.label
19
+ assert_equal 'show', link.action
20
+ assert_equal 'Show', link.label
21
21
  assert link.inline?
22
22
  blank = {}
23
23
  assert_equal blank, link.html_options
@@ -26,12 +26,12 @@ module Config
26
26
  assert_equal :read, link.crud_type
27
27
  assert_equal :show_authorized?, link.security_method
28
28
  end
29
-
29
+
30
30
  def test_setting_link
31
31
  @config.show.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
32
32
  refute_equal @default_link, @config.show.link
33
33
  end
34
-
34
+
35
35
  def test_label
36
36
  label = 'show monkeys'
37
37
  @config.show.label = label
@@ -9,7 +9,7 @@ module Config
9
9
  def test_defaults
10
10
  assert_equal :horizontal, @config.subform.layout
11
11
  end
12
-
12
+
13
13
  def test_setting_layout
14
14
  layout = :vertical
15
15
  @config.subform.layout = layout
@@ -5,31 +5,31 @@ module Config
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  end
8
-
8
+
9
9
  def test__params_for_columns__returns_all_params
10
10
  @config._load_action_columns
11
11
  @config.columns[:a].params.add :keep_a, :a_temp
12
12
  assert @config.columns[:a].params.include?(:keep_a)
13
13
  assert @config.columns[:a].params.include?(:a_temp)
14
14
  end
15
-
15
+
16
16
  def test_default_options
17
17
  refute @config.update.persistent
18
18
  refute @config.update.nested_links
19
19
  assert_equal 'Model stub', @config.update.label
20
20
  end
21
-
21
+
22
22
  def test_persistent
23
23
  @config.update.persistent = true
24
24
  assert @config.update.persistent
25
25
  end
26
-
26
+
27
27
  def test_nested_links
28
28
  old, @config.update.nested_links = @config.update.nested_links, true
29
29
  assert @config.update.nested_links
30
30
  @config.update.nested_links = old
31
31
  end
32
-
32
+
33
33
  def test_label
34
34
  label = 'update new monkeys'
35
35
  @config.update.label = label
@@ -5,15 +5,15 @@ class ConstMocker
5
5
  @const_state = nil
6
6
  @const_state = @parent.const_defined?(@const_name) ? @parent.const_get(@const_name) : nil
7
7
  end
8
-
8
+
9
9
  def remove
10
10
  @parent.send :remove_const, @const_name if @parent.const_defined?(@const_name)
11
11
  end
12
-
12
+
13
13
  def declare
14
14
  @parent.const_set @const_name, Class.new
15
15
  end
16
-
16
+
17
17
  def restore
18
18
  remove
19
19
  @parent.const_set @const_name, @const_state if @const_state
@@ -22,7 +22,7 @@ class ConstMocker
22
22
  def const
23
23
  @parent.const_get @const_name if @parent.const_defined?(@const_name)
24
24
  end
25
-
25
+
26
26
  def self.mock(const_name, parent = Object, &block)
27
27
  cm = new(const_name, parent)
28
28
  yield(cm)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
  # require 'test/model_stub'
3
- #require File.join(File.dirname(__FILE__), '../../lib/active_scaffold/data_structures/set.rb')
3
+ # require File.join(File.dirname(__FILE__), '../../lib/active_scaffold/data_structures/set.rb')
4
4
 
5
5
  class ActionColumnsTest < MiniTest::Test
6
6
  def setup
@@ -61,7 +61,6 @@ class ActionColumnsTest < MiniTest::Test
61
61
  @columns.add [:f, :g]
62
62
  assert @columns.include?(:f)
63
63
  assert @columns.include?(:g)
64
-
65
64
  end
66
65
 
67
66
  def test_length
@@ -77,7 +76,7 @@ class ActionColumnsTest < MiniTest::Test
77
76
  # then use the shortcut
78
77
  @columns.add_subgroup 'foo' do
79
78
  end
80
- assert @columns.any? { |c| c.respond_to? :label and c.label == 'foo' }
79
+ assert @columns.any? { |c| c.respond_to?(:label) && c.label == 'foo' }
81
80
  end
82
81
 
83
82
  def test_block_config
@@ -93,11 +92,11 @@ class ActionColumnsTest < MiniTest::Test
93
92
 
94
93
  assert @columns.include?(:c)
95
94
  refute @columns.include?(:b)
96
- @columns.each { |c|
95
+ @columns.each do |c|
97
96
  next unless c.is_a? ActiveScaffold::DataStructures::Columns
98
97
  assert c.include?(:e)
99
98
  assert_equal 'my subgroup', c.name
100
- }
99
+ end
101
100
  end
102
101
 
103
102
  def test_include