activeadmin 1.0.0.pre5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeadmin might be problematic. Click here for more details.

Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +27 -0
  3. data/.travis.yml +21 -23
  4. data/Appraisals +12 -74
  5. data/CHANGELOG.md +21 -5
  6. data/CONTRIBUTING.md +2 -2
  7. data/Gemfile +8 -9
  8. data/README.md +19 -56
  9. data/Rakefile +1 -1
  10. data/activeadmin.gemspec +4 -4
  11. data/app/assets/stylesheets/active_admin/_forms.scss +10 -0
  12. data/config/locales/ca.yml +1 -1
  13. data/config/locales/da.yml +44 -12
  14. data/config/locales/el.yml +1 -1
  15. data/config/locales/en.yml +2 -0
  16. data/config/locales/fr.yml +16 -2
  17. data/config/locales/ja.yml +1 -0
  18. data/config/locales/zh-CN.yml +4 -0
  19. data/docs/12-arbre-components.md +23 -0
  20. data/docs/14-gotchas.md +1 -1
  21. data/docs/2-resource-customization.md +2 -5
  22. data/docs/5-forms.md +19 -0
  23. data/docs/6-show-pages.md +0 -28
  24. data/docs/9-batch-actions.md +0 -1
  25. data/docs/CNAME +1 -1
  26. data/docs/_includes/head.html +4 -4
  27. data/docs/_includes/toc.html +2 -1
  28. data/docs/documentation.md +2 -2
  29. data/docs/index.html +1 -6
  30. data/docs/stylesheets/main.css +172 -219
  31. data/features/belongs_to.feature +5 -5
  32. data/features/comments/commenting.feature +0 -13
  33. data/features/create_another.feature +55 -0
  34. data/features/development_reloading.feature +2 -4
  35. data/features/edit_page.feature +6 -7
  36. data/features/favicon.feature +2 -2
  37. data/features/i18n.feature +1 -0
  38. data/features/index/filters.feature +18 -0
  39. data/features/index/format_as_csv.feature +3 -3
  40. data/features/index/formats.feature +22 -0
  41. data/features/index/index_as_table.feature +6 -6
  42. data/features/index/page_title.feature +1 -2
  43. data/features/menu.feature +20 -1
  44. data/features/new_page.feature +6 -8
  45. data/features/registering_assets.feature +4 -4
  46. data/features/registering_pages.feature +18 -0
  47. data/features/renamed_resource.feature +2 -4
  48. data/features/show/page_title.feature +1 -2
  49. data/features/step_definitions/attribute_steps.rb +1 -1
  50. data/features/step_definitions/configuration_steps.rb +2 -2
  51. data/features/step_definitions/format_steps.rb +4 -0
  52. data/features/step_definitions/index_scope_steps.rb +1 -1
  53. data/features/step_definitions/menu_steps.rb +2 -2
  54. data/features/step_definitions/user_steps.rb +1 -1
  55. data/features/step_definitions/web_steps.rb +6 -5
  56. data/features/sti_resource.feature +2 -2
  57. data/features/strong_parameters.feature +0 -4
  58. data/features/support/env.rb +5 -19
  59. data/features/support/paths.rb +6 -9
  60. data/gemfiles/rails_42.gemfile +15 -23
  61. data/gemfiles/rails_50.gemfile +15 -16
  62. data/gemfiles/rails_51.gemfile +45 -0
  63. data/lib/active_admin/application.rb +4 -0
  64. data/lib/active_admin/base_controller.rb +2 -7
  65. data/lib/active_admin/base_controller/menu.rb +1 -5
  66. data/lib/active_admin/csv_builder.rb +2 -2
  67. data/lib/active_admin/dependency.rb +4 -8
  68. data/lib/active_admin/devise.rb +1 -1
  69. data/lib/active_admin/error.rb +1 -1
  70. data/lib/active_admin/filters/active.rb +2 -10
  71. data/lib/active_admin/filters/resource_extension.rb +1 -10
  72. data/lib/active_admin/inputs/filters/date_range_input.rb +1 -1
  73. data/lib/active_admin/inputs/filters/select_input.rb +1 -2
  74. data/lib/active_admin/inputs/filters/text_input.rb +2 -2
  75. data/lib/active_admin/menu.rb +1 -1
  76. data/lib/active_admin/namespace.rb +14 -7
  77. data/lib/active_admin/orm/active_record/comments.rb +2 -7
  78. data/lib/active_admin/orm/active_record/comments/comment.rb +2 -12
  79. data/lib/active_admin/page.rb +5 -0
  80. data/lib/active_admin/page_controller.rb +1 -5
  81. data/lib/active_admin/resource.rb +28 -5
  82. data/lib/active_admin/resource/attributes.rb +44 -0
  83. data/lib/active_admin/resource/menu.rb +4 -1
  84. data/lib/active_admin/resource/routes.rb +2 -3
  85. data/lib/active_admin/resource_controller.rb +13 -0
  86. data/lib/active_admin/resource_controller/data_access.rb +18 -9
  87. data/lib/active_admin/resource_dsl.rb +21 -18
  88. data/lib/active_admin/version.rb +1 -1
  89. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +1 -1
  90. data/lib/active_admin/view_helpers/display_helper.rb +10 -12
  91. data/lib/active_admin/view_helpers/download_format_links_helper.rb +12 -0
  92. data/lib/active_admin/view_helpers/fields_for.rb +1 -2
  93. data/lib/active_admin/view_helpers/form_helper.rb +1 -1
  94. data/lib/active_admin/views/components/active_admin_form.rb +28 -2
  95. data/lib/active_admin/views/components/paginated_collection.rb +3 -8
  96. data/lib/active_admin/views/components/table_for.rb +1 -1
  97. data/lib/active_admin/views/index_as_table.rb +2 -2
  98. data/lib/active_admin/views/pages/layout.rb +1 -1
  99. data/lib/active_admin/views/pages/show.rb +1 -1
  100. data/lib/bug_report_templates/rails_5_master.rb +1 -3
  101. data/lib/generators/active_admin/devise/devise_generator.rb +1 -1
  102. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +7 -0
  103. data/lib/generators/active_admin/install/templates/admin_user.rb.erb +0 -2
  104. data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb +5 -7
  105. data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
  106. data/lib/generators/active_admin/resource/templates/{admin.rb → admin.rb.erb} +0 -2
  107. data/lib/ransack_ext.rb +2 -2
  108. data/spec/rails_helper.rb +1 -19
  109. data/spec/requests/default_namespace_spec.rb +40 -8
  110. data/spec/support/active_admin_integration_spec_helper.rb +9 -2
  111. data/spec/support/rails_template.rb +17 -20
  112. data/spec/support/rails_template_with_data.rb +3 -9
  113. data/spec/support/templates/admin/stores.rb +1 -3
  114. data/spec/unit/application_spec.rb +19 -8
  115. data/spec/unit/belongs_to_spec.rb +6 -2
  116. data/spec/unit/comments_spec.rb +0 -19
  117. data/spec/unit/controller_filters_spec.rb +5 -5
  118. data/spec/unit/csv_builder_spec.rb +7 -4
  119. data/spec/unit/filters/active_spec.rb +1 -8
  120. data/spec/unit/filters/filter_form_builder_spec.rb +2 -3
  121. data/spec/unit/filters/resource_spec.rb +3 -4
  122. data/spec/unit/form_builder_spec.rb +39 -11
  123. data/spec/unit/namespace/register_page_spec.rb +1 -1
  124. data/spec/unit/pretty_format_spec.rb +39 -35
  125. data/spec/unit/resource/attributes_spec.rb +50 -0
  126. data/spec/unit/resource/includes_spec.rb +1 -1
  127. data/spec/unit/resource/ordering_spec.rb +1 -1
  128. data/spec/unit/resource/routes_spec.rb +2 -2
  129. data/spec/unit/resource_controller/data_access_spec.rb +51 -10
  130. data/spec/unit/resource_controller/decorators_spec.rb +2 -2
  131. data/spec/unit/resource_controller/sidebars_spec.rb +3 -3
  132. data/spec/unit/resource_controller_spec.rb +16 -5
  133. data/spec/unit/resource_spec.rb +12 -38
  134. data/spec/unit/routing_spec.rb +2 -2
  135. data/spec/unit/view_helpers/breadcrumbs_spec.rb +36 -1
  136. data/spec/unit/view_helpers/display_helper_spec.rb +17 -2
  137. data/spec/unit/view_helpers/fields_for_spec.rb +1 -1
  138. data/spec/unit/view_helpers/form_helper_spec.rb +3 -3
  139. data/spec/unit/view_helpers/method_or_proc_helper_spec.rb +2 -2
  140. data/spec/unit/views/components/attributes_table_spec.rb +2 -2
  141. data/spec/unit/views/components/index_list_spec.rb +1 -1
  142. data/spec/unit/views/components/paginated_collection_spec.rb +4 -4
  143. data/spec/unit/views/components/table_for_spec.rb +1 -1
  144. data/spec/unit/views/components/unsupported_browser_spec.rb +1 -1
  145. data/spec/unit/views/pages/form_spec.rb +4 -1
  146. data/spec/unit/views/pages/index_spec.rb +1 -1
  147. data/spec/unit/views/pages/show_spec.rb +2 -3
  148. data/tasks/lint.rake +8 -0
  149. metadata +22 -29
  150. data/features/step_definitions/symbol_leak_steps.rb +0 -3
  151. data/features/symbol_leak.feature +0 -35
  152. data/gemfiles/rails_32.gemfile +0 -54
  153. data/gemfiles/rails_40.gemfile +0 -53
  154. data/gemfiles/rails_41.gemfile +0 -53
  155. data/spec/support/deferred_garbage_collection.rb +0 -19
@@ -16,8 +16,8 @@ Feature: Belongs To
16
16
  end
17
17
  """
18
18
  When I go to the last author's posts
19
- Then the "Posts" tab should be selected
20
- And I should not see a menu item for "Users"
19
+ Then the "Users" tab should be selected
20
+ And I should not see a menu item for "Posts"
21
21
  And I should see "Displaying 1 Post"
22
22
  And I should see a link to "Users" in the breadcrumb
23
23
  And I should see a link to "Jane Doe" in the breadcrumb
@@ -28,7 +28,7 @@ Feature: Belongs To
28
28
  ActiveAdmin.register User
29
29
  ActiveAdmin.register Post do
30
30
  belongs_to :user
31
- permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4
31
+ permit_params :title, :body, :published_date
32
32
 
33
33
  form do |f|
34
34
  f.inputs "Your Post" do
@@ -56,7 +56,7 @@ Feature: Belongs To
56
56
  ActiveAdmin.register User
57
57
  ActiveAdmin.register Post do
58
58
  belongs_to :user
59
- permit_params :title, :body, :published_date if Rails::VERSION::MAJOR >= 4
59
+ permit_params :title, :body, :published_date
60
60
 
61
61
  form do |f|
62
62
  f.inputs "Your Post" do
@@ -93,7 +93,7 @@ Feature: Belongs To
93
93
  When I go to the last author's posts
94
94
  And I follow "View"
95
95
  Then I should be on the last author's last post page
96
- And the "Posts" tab should be selected
96
+ And the "Users" tab should be selected
97
97
 
98
98
  Scenario: When the belongs to is optional
99
99
  Given a configuration of:
@@ -145,19 +145,6 @@ Feature: Commenting
145
145
  And I should be in the resource section for publishers
146
146
  And I should see "Hello World"
147
147
 
148
- Scenario: Commenting on a class with string id
149
- Given a tag with the name "coolness" exists
150
- Given a configuration of:
151
- """
152
- ActiveAdmin.register Tag
153
- """
154
- Given I am logged in
155
- When I am on the index page for tags
156
- And I follow "View"
157
- When I add a comment "Tag Comment"
158
- Then I should see a flash with "Comment was successfully created"
159
- And I should be in the resource section for tags
160
-
161
148
  Scenario: Commenting on an aliased resource with an existing non-aliased config
162
149
  Given a configuration of:
163
150
  """
@@ -0,0 +1,55 @@
1
+ Feature: Create Another checkbox
2
+
3
+ Background:
4
+ Given I am logged in
5
+
6
+ Scenario: On a new page
7
+ Given a configuration of:
8
+ """
9
+ ActiveAdmin.register Post do
10
+ config.create_another = true
11
+
12
+ permit_params :custom_category_id, :author_id, :title,
13
+ :body, :position, :published_date, :starred
14
+ end
15
+ """
16
+ Then I am on the index page for posts
17
+ And I follow "New Post"
18
+ When I fill in "Title" with "Hello World"
19
+ And I fill in "Body" with "This is the body"
20
+ And the "Create another Post" checkbox should not be checked
21
+ And I check "Create another"
22
+ And I press "Create Post"
23
+ Then I should see "Post was successfully created."
24
+ And I should see "New Post"
25
+ And the "Create another" checkbox should be checked
26
+ When I fill in "Title" with "Another Hello World"
27
+ And I fill in "Body" with "This is the another body"
28
+ And I uncheck "Create another"
29
+ And I press "Create Post"
30
+ Then I should see "Post was successfully created."
31
+ And I should see the attribute "Title" with "Another Hello World"
32
+ And I should see the attribute "Body" with "This is the another body"
33
+
34
+ Scenario: Application config of false and a resource config of true
35
+ Given a configuration of:
36
+ """
37
+ ActiveAdmin.application.create_another = false
38
+ ActiveAdmin.register Post do
39
+ config.create_another = true
40
+ end
41
+ """
42
+ When I am on the new post page
43
+ Then I should see the element ".create_another"
44
+ Then the "Create another Post" checkbox should not be checked
45
+
46
+ Scenario: Application config of true and a resource config of false
47
+ Given a configuration of:
48
+ """
49
+ ActiveAdmin.application.create_another = true
50
+ ActiveAdmin.register Post do
51
+ config.create_another = false
52
+ end
53
+ """
54
+ When I am on the new post page
55
+ Then I should not see the element ".create_another"
@@ -12,10 +12,8 @@ Feature: Development Reloading
12
12
  When "app/admin/posts.rb" contains:
13
13
  """
14
14
  ActiveAdmin.register Post do
15
- if Rails::VERSION::MAJOR >= 4
16
- permit_params :custom_category_id, :author_id, :title,
17
- :body, :position, :published_date, :starred
18
- end
15
+ permit_params :custom_category_id, :author_id, :title,
16
+ :body, :position, :published_date, :starred
19
17
  end
20
18
  """
21
19
  When I am logged in with capybara
@@ -10,10 +10,8 @@ Feature: Edit Page
10
10
  Given a configuration of:
11
11
  """
12
12
  ActiveAdmin.register Post do
13
- if Rails::VERSION::MAJOR >= 4
14
- permit_params :custom_category_id, :author_id, :title,
15
- :body, :position, :published_date, :starred
16
- end
13
+ permit_params :custom_category_id, :author_id, :title,
14
+ :body, :position, :published_date, :starred
17
15
  end
18
16
  """
19
17
  When I am on the index page for posts
@@ -25,6 +23,7 @@ Feature: Edit Page
25
23
  And the "Category" field should contain ""
26
24
  And the "Author" field should contain the option "John Doe"
27
25
  When I fill in "Title" with "Hello World from update"
26
+ And I should not see the element "Create another"
28
27
  When I press "Update Post"
29
28
  Then I should see "Post was successfully updated."
30
29
  And I should see the attribute "Title" with "Hello World from update"
@@ -34,7 +33,7 @@ Feature: Edit Page
34
33
  Given a configuration of:
35
34
  """
36
35
  ActiveAdmin.register Post do
37
- permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
36
+ permit_params :category, :author, :title, :body, :published_date, :starred
38
37
 
39
38
  form do |f|
40
39
  f.inputs "Your Post" do
@@ -63,7 +62,7 @@ Feature: Edit Page
63
62
  Given a configuration of:
64
63
  """
65
64
  ActiveAdmin.register Post do
66
- permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
65
+ permit_params :category, :author, :title, :body, :published_date, :starred
67
66
 
68
67
  form html: {} do |f|
69
68
  f.inputs "Your Post" do
@@ -102,7 +101,7 @@ Feature: Edit Page
102
101
  Given a configuration of:
103
102
  """
104
103
  ActiveAdmin.register Post do
105
- permit_params :category, :author, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
104
+ permit_params :category, :author, :title, :body, :published_date, :starred
106
105
 
107
106
  form partial: "form"
108
107
  end
@@ -12,9 +12,9 @@ Feature: Favicon
12
12
  Scenario: Logged out views show Favicon
13
13
  Given I am logged out
14
14
  When I am on the login page
15
- Then I should see the favicon "a/favicon.ico"
15
+ Then I should see the favicon "favicon"
16
16
 
17
17
  Scenario: Logged in views show Favicon
18
18
  Given I am logged in
19
19
  When I am on the dashboard
20
- Then I should see the favicon "a/favicon.ico"
20
+ Then I should see the favicon "favicon"
@@ -1,3 +1,4 @@
1
+ @locale_manipulation
1
2
  Feature: Internationalization
2
3
 
3
4
  ActiveAdmin should use the translations provided by the host app.
@@ -38,6 +38,24 @@ Feature: Index Filtering
38
38
  And I should not see pagination
39
39
  And I should see "No Posts found"
40
40
 
41
+ Scenario: Filtering posts with pagination
42
+ Given 7 posts with the title "Hello World 3" exist
43
+ And 1 post with the title "Hello World 4" exist
44
+ And an index configuration of:
45
+ """
46
+ ActiveAdmin.register Post do
47
+ config.per_page = 2
48
+ end
49
+ """
50
+ When I fill in "Title" with "Hello World 3"
51
+ And I press "Filter"
52
+
53
+ Then I follow "2"
54
+ Then I should see "Displaying Posts 3 - 4 of 7 in total"
55
+
56
+ Then I follow "3"
57
+ Then I should see "Displaying Posts 5 - 6 of 7 in total"
58
+
41
59
  Scenario: Filtering posts while not on the first page
42
60
  Given 9 posts exist
43
61
  And an index configuration of:
@@ -12,8 +12,8 @@ Feature: Format as CSV
12
12
  When I am on the index page for posts
13
13
  And I follow "CSV"
14
14
  And I should download a CSV file for "posts" containing:
15
- | Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
16
- | \d+ | Hello World | | | | | (.*) | (.*) |
15
+ | Id | Title | Body | Published date | Position | Starred | Foo |Created at | Updated at |
16
+ | \d+ | Hello World | | | | | |(.*) | (.*) |
17
17
 
18
18
  Scenario: Default with alias
19
19
  Given a configuration of:
@@ -24,7 +24,7 @@ Feature: Format as CSV
24
24
  When I am on the index page for my_articles
25
25
  And I follow "CSV"
26
26
  And I should download a CSV file for "my-articles" containing:
27
- | Id | Title | Body | Published date | Position | Starred | Created at | Updated at |
27
+ | Id | Title | Body | Published date | Position | Starred | Foo | Created at | Updated at |
28
28
 
29
29
  Scenario: With CSV format customization
30
30
  Given a configuration of:
@@ -51,6 +51,15 @@ Feature: Index Formats
51
51
  And I should not see a link to download "XML"
52
52
  And I should not see a link to download "JSON"
53
53
 
54
+ When I go to the csv index page for posts
55
+ Then access denied
56
+
57
+ When I go to the xml index page for posts
58
+ Then access denied
59
+
60
+ When I go to the json index page for posts
61
+ Then access denied
62
+
54
63
  Scenario: View index with download_links block which returns [:csv]
55
64
  Given an index configuration of:
56
65
  """
@@ -64,3 +73,16 @@ Feature: Index Formats
64
73
  And I should not see a link to download "XML"
65
74
  And I should not see a link to download "JSON"
66
75
  And I should not see a link to download "PDF"
76
+
77
+ Scenario: View index with restricted formats
78
+ Given an index configuration of:
79
+ """
80
+ ActiveAdmin.register Post do
81
+ index download_links: -> { [:json] }
82
+ end
83
+ """
84
+ When I go to the csv index page for posts
85
+ Then access denied
86
+
87
+ When I go to the xml index page for posts
88
+ Then access denied
@@ -250,14 +250,14 @@ Feature: Index as Table
250
250
  """
251
251
  When I am on the index page for posts
252
252
  Then I should see the "index_table_posts" table:
253
- | [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
254
- | [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
255
- | [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
253
+ | [ ] | Id | Title | Body | Published Date | Author | Position | Category | Starred | Foo | Created At | Updated At | |
254
+ | [ ] | 2 | Bye bye world | Move your... | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
255
+ | [ ] | 1 | Hello World | From the body | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
256
256
  When I follow "Id"
257
257
  Then I should see the "index_table_posts" table:
258
- | [ ] | Id | Title | Body | Published Date | Position | Starred | Created At | Updated At | |
259
- | [ ] | 1 | Hello World | From the body | | | No | /.*/ | /.*/ | ViewEditDelete |
260
- | [ ] | 2 | Bye bye world | Move your... | | | No | /.*/ | /.*/ | ViewEditDelete |
258
+ | [ ] | Id | Title | Body | Published Date | Author | Position | Category | Starred | Foo | Created At | Updated At | |
259
+ | [ ] | 1 | Hello World | From the body | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
260
+ | [ ] | 2 | Bye bye world | Move your... | | | | | No | | /.*/ | /.*/ | ViewEditDelete |
261
261
 
262
262
  Scenario: Sorting by a virtual column
263
263
  Given a post with the title "Hello World" exists
@@ -34,8 +34,7 @@ Feature: Index - Page Title
34
34
  """
35
35
  ActiveAdmin.register Post do
36
36
  controller do
37
- callback = ActiveAdmin::Dependency.rails >= 4 ? :before_action : :before_filter
38
- send(callback) { @page_title = "List of #{resource_class.model_name.plural}" }
37
+ before_action { @page_title = "List of #{resource_class.model_name.plural}" }
39
38
  end
40
39
  end
41
40
  """
@@ -43,11 +43,30 @@ Feature: Menu
43
43
  """
44
44
  ActiveAdmin.register User
45
45
  ActiveAdmin.register Post do
46
- menu parent: 'User'
46
+ menu parent: 'Users'
47
47
  end
48
48
  """
49
49
  When I am on the dashboard
50
50
  Then I should see a menu item for "Users"
51
+ And I should not see a menu item for "Posts"
51
52
  When I follow "Users"
52
53
  Then the "Users" tab should be selected
53
54
  And I should see a nested menu item for "Posts"
55
+
56
+ Scenario: Adding a resources as a sub menu items
57
+ Given a configuration of:
58
+ """
59
+ ActiveAdmin.register Category do
60
+ menu parent: 'Anything'
61
+ end
62
+ ActiveAdmin.register Post do
63
+ menu parent: 'Anything'
64
+ end
65
+ """
66
+ When I am on the dashboard
67
+ Then I should see a menu item for "Anything"
68
+ And I should not see a menu item for "Categories"
69
+ And I should not see a menu item for "Posts"
70
+ And I should see a nested menu item for "Categories"
71
+ And I should see a nested menu item for "Posts"
72
+
@@ -9,10 +9,8 @@ Feature: New Page
9
9
  Given a configuration of:
10
10
  """
11
11
  ActiveAdmin.register Post do
12
- if Rails::VERSION::MAJOR >= 4
13
- permit_params :custom_category_id, :author_id, :title,
14
- :body, :position, :published_date, :starred
15
- end
12
+ permit_params :custom_category_id, :author_id, :title,
13
+ :body, :position, :published_date, :starred
16
14
  end
17
15
  """
18
16
  When I am on the index page for posts
@@ -27,14 +25,14 @@ Feature: New Page
27
25
  Then I should see "Post was successfully created."
28
26
  And I should see the attribute "Title" with "Hello World"
29
27
  And I should see the attribute "Body" with "This is the body"
30
- #And I should see the attribute "Category" with "Music"
28
+ And I should see the attribute "Category" with "Music"
31
29
  And I should see the attribute "Author" with "John Doe"
32
30
 
33
31
  Scenario: Generating a custom form
34
32
  Given a configuration of:
35
33
  """
36
34
  ActiveAdmin.register Post do
37
- permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
35
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
38
36
 
39
37
  form do |f|
40
38
  f.inputs "Your Post" do
@@ -70,7 +68,7 @@ Feature: New Page
70
68
  Given a configuration of:
71
69
  """
72
70
  ActiveAdmin.register Post do
73
- permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
71
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
74
72
 
75
73
  form partial: "form"
76
74
  end
@@ -87,7 +85,7 @@ Feature: New Page
87
85
  Given a configuration of:
88
86
  """
89
87
  ActiveAdmin.register Post do
90
- permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred if Rails::VERSION::MAJOR >= 4
88
+ permit_params :custom_category_id, :author_id, :title, :body, :published_date, :starred
91
89
 
92
90
  form do |f|
93
91
  f.inputs "Your Post" do
@@ -12,8 +12,8 @@ Feature: Registering Assets
12
12
 
13
13
  Scenario: Viewing default asset files
14
14
  When I am on the index page for posts
15
- Then I should see the css file "active_admin.css"
16
- Then I should see the js file "active_admin.js"
15
+ Then I should see the css file "active_admin"
16
+ Then I should see the js file "active_admin"
17
17
 
18
18
  Scenario: Registering a CSS file
19
19
  Given a configuration of:
@@ -22,7 +22,7 @@ Feature: Registering Assets
22
22
  ActiveAdmin.register Post
23
23
  """
24
24
  When I am on the index page for posts
25
- Then I should see the css file "some-random-css.css" of media "print"
25
+ Then I should see the css file "some-random-css" of media "print"
26
26
 
27
27
  Scenario: Registering a JS file
28
28
  Given a configuration of:
@@ -31,4 +31,4 @@ Feature: Registering Assets
31
31
  ActiveAdmin.register Post
32
32
  """
33
33
  When I am on the index page for posts
34
- Then I should see the js file "some-random-js.js"
34
+ Then I should see the js file "some-random-js"
@@ -217,3 +217,21 @@ Feature: Registering Pages
217
217
  Then I should see the content "Status page for Post 1"
218
218
  And I should see a link to "Post 1" in the breadcrumb
219
219
 
220
+ Scenario: Rendering sortable table_for within page
221
+ Given a configuration of:
222
+ """
223
+ ActiveAdmin.register Post
224
+ ActiveAdmin.register_page "Last Posts" do
225
+ content do
226
+ table_for Post.last(2), sortable: true, class: "index_table" do
227
+ column :id
228
+ column :title
229
+ column :author
230
+ end
231
+ end
232
+ end
233
+ """
234
+ And a post with the title "Hello World" written by "Jane Doe" exists
235
+ When I go to the last posts page
236
+ Then I should see the page title "Last Posts"
237
+ And I should see 1 post in the table
@@ -9,10 +9,8 @@ Feature: Renamed Resource
9
9
  Given a configuration of:
10
10
  """
11
11
  ActiveAdmin.register Blog::Post, as: 'Post' do
12
- if Rails::VERSION::MAJOR >= 4
13
- permit_params :custom_category_id, :author_id, :title,
14
- :body, :position, :published_date, :starred
15
- end
12
+ permit_params :custom_category_id, :author_id, :title,
13
+ :body, :position, :published_date, :starred
16
14
  end
17
15
  """
18
16
  When I am on the index page for posts
@@ -51,8 +51,7 @@ Feature: Show - Page Title
51
51
  """
52
52
  ActiveAdmin.register Post do
53
53
  controller do
54
- callback = ActiveAdmin::Dependency.rails >= 4 ? :before_action : :before_filter
55
- send(callback) { @page_title = "List of #{resource_class.model_name.plural}" }
54
+ before_action { @page_title = "List of #{resource_class.model_name.plural}" }
56
55
  end
57
56
  end
58
57
  """