express_admin 1.7.5 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/express_admin/components/command_button.js.coffee +25 -0
  3. data/app/assets/stylesheets/express_admin/components/_command_button.sass +6 -1
  4. data/app/assets/stylesheets/express_admin/globals/_variables.sass +2 -0
  5. data/app/assets/stylesheets/express_admin/plugins/_select2.sass +3 -0
  6. data/app/assets/stylesheets/express_admin/screen.sass +0 -2
  7. data/app/assets/stylesheets/express_admin/shared/_tables.sass +2 -0
  8. data/app/components/express_admin/command_button.rb +9 -3
  9. data/app/components/express_admin/definition_table.rb +1 -1
  10. data/app/components/express_admin/smart_table.rb +6 -0
  11. data/app/views/layouts/devise.html.erb +19 -0
  12. data/config/initializers/postgresql_trigram.rb +13 -0
  13. data/db/migrate/20150928044202_install_trigram.rb +18 -0
  14. data/lib/express_admin/engine.rb +4 -2
  15. data/lib/express_admin/search.rb +51 -0
  16. data/lib/express_admin/standard_actions.rb +18 -5
  17. data/lib/express_admin/version.rb +1 -1
  18. data/test/dummy/db/test.sqlite3 +0 -0
  19. data/test/dummy/test/components/command_button_test.rb +2 -2
  20. metadata +22 -160
  21. data/app/assets/stylesheets/express_admin/shared/_buttons.sass +0 -3
  22. data/app/assets/stylesheets/express_admin/shared/_tabs.sass +0 -25
  23. data/vendor/gems/express_templates/CHANGELOG.md +0 -12
  24. data/vendor/gems/express_templates/Gemfile +0 -16
  25. data/vendor/gems/express_templates/LICENSE +0 -21
  26. data/vendor/gems/express_templates/README.md +0 -133
  27. data/vendor/gems/express_templates/Rakefile +0 -32
  28. data/vendor/gems/express_templates/express_templates.gemspec +0 -32
  29. data/vendor/gems/express_templates/lib/arbre/patches.rb +0 -76
  30. data/vendor/gems/express_templates/lib/core_extensions/proc.rb +0 -103
  31. data/vendor/gems/express_templates/lib/core_extensions/string.rb +0 -25
  32. data/vendor/gems/express_templates/lib/express_templates/compiler.rb +0 -22
  33. data/vendor/gems/express_templates/lib/express_templates/components/all.rb +0 -28
  34. data/vendor/gems/express_templates/lib/express_templates/components/base.rb +0 -156
  35. data/vendor/gems/express_templates/lib/express_templates/components/capabilities/resourceful.rb +0 -213
  36. data/vendor/gems/express_templates/lib/express_templates/components/configurable.rb +0 -181
  37. data/vendor/gems/express_templates/lib/express_templates/components/container.rb +0 -45
  38. data/vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb +0 -52
  39. data/vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb +0 -37
  40. data/vendor/gems/express_templates/lib/express_templates/components/forms/express_form.rb +0 -48
  41. data/vendor/gems/express_templates/lib/express_templates/components/forms/form_component.rb +0 -88
  42. data/vendor/gems/express_templates/lib/express_templates/components/forms/option_support.rb +0 -69
  43. data/vendor/gems/express_templates/lib/express_templates/components/forms/radio.rb +0 -65
  44. data/vendor/gems/express_templates/lib/express_templates/components/forms/select.rb +0 -126
  45. data/vendor/gems/express_templates/lib/express_templates/components/forms/select_collection.rb +0 -45
  46. data/vendor/gems/express_templates/lib/express_templates/components/forms/submit.rb +0 -30
  47. data/vendor/gems/express_templates/lib/express_templates/components/forms.rb +0 -16
  48. data/vendor/gems/express_templates/lib/express_templates/components/tree_for.rb +0 -88
  49. data/vendor/gems/express_templates/lib/express_templates/components.rb +0 -11
  50. data/vendor/gems/express_templates/lib/express_templates/indenter.rb +0 -47
  51. data/vendor/gems/express_templates/lib/express_templates/interpolator.rb +0 -36
  52. data/vendor/gems/express_templates/lib/express_templates/renderer.rb +0 -9
  53. data/vendor/gems/express_templates/lib/express_templates/template/handler.rb +0 -32
  54. data/vendor/gems/express_templates/lib/express_templates/version.rb +0 -3
  55. data/vendor/gems/express_templates/lib/express_templates.rb +0 -18
  56. data/vendor/gems/express_templates/lib/tasks/express_templates.rake +0 -4
  57. data/vendor/gems/express_templates/test/compiler_test.rb +0 -9
  58. data/vendor/gems/express_templates/test/components/base_test.rb +0 -67
  59. data/vendor/gems/express_templates/test/components/capabilities/resourceful_test.rb +0 -63
  60. data/vendor/gems/express_templates/test/components/configurable_test.rb +0 -140
  61. data/vendor/gems/express_templates/test/components/forms/basic_fields_test.rb +0 -158
  62. data/vendor/gems/express_templates/test/components/forms/checkbox_test.rb +0 -51
  63. data/vendor/gems/express_templates/test/components/forms/express_form_test.rb +0 -62
  64. data/vendor/gems/express_templates/test/components/forms/radio_test.rb +0 -112
  65. data/vendor/gems/express_templates/test/components/forms/select_test.rb +0 -129
  66. data/vendor/gems/express_templates/test/components/forms/submit_test.rb +0 -36
  67. data/vendor/gems/express_templates/test/components/tree_for_test.rb +0 -70
  68. data/vendor/gems/express_templates/test/core_extensions/proc_test.rb +0 -90
  69. data/vendor/gems/express_templates/test/core_extensions/string_test.rb +0 -20
  70. data/vendor/gems/express_templates/test/dummy/Rakefile +0 -6
  71. data/vendor/gems/express_templates/test/dummy/app/assets/javascripts/application.js +0 -13
  72. data/vendor/gems/express_templates/test/dummy/app/assets/stylesheets/application.css +0 -15
  73. data/vendor/gems/express_templates/test/dummy/app/controllers/application_controller.rb +0 -5
  74. data/vendor/gems/express_templates/test/dummy/app/controllers/hello_controller.rb +0 -5
  75. data/vendor/gems/express_templates/test/dummy/app/helpers/application_helper.rb +0 -2
  76. data/vendor/gems/express_templates/test/dummy/app/views/hello/show.html.et +0 -6
  77. data/vendor/gems/express_templates/test/dummy/app/views/layouts/application.html.et +0 -15
  78. data/vendor/gems/express_templates/test/dummy/bin/bundle +0 -3
  79. data/vendor/gems/express_templates/test/dummy/bin/rails +0 -4
  80. data/vendor/gems/express_templates/test/dummy/bin/rake +0 -4
  81. data/vendor/gems/express_templates/test/dummy/config/application.rb +0 -26
  82. data/vendor/gems/express_templates/test/dummy/config/boot.rb +0 -5
  83. data/vendor/gems/express_templates/test/dummy/config/environment.rb +0 -5
  84. data/vendor/gems/express_templates/test/dummy/config/environments/development.rb +0 -37
  85. data/vendor/gems/express_templates/test/dummy/config/environments/production.rb +0 -82
  86. data/vendor/gems/express_templates/test/dummy/config/environments/test.rb +0 -40
  87. data/vendor/gems/express_templates/test/dummy/config/initializers/assets.rb +0 -8
  88. data/vendor/gems/express_templates/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  89. data/vendor/gems/express_templates/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  90. data/vendor/gems/express_templates/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  91. data/vendor/gems/express_templates/test/dummy/config/initializers/inflections.rb +0 -16
  92. data/vendor/gems/express_templates/test/dummy/config/initializers/mime_types.rb +0 -4
  93. data/vendor/gems/express_templates/test/dummy/config/initializers/session_store.rb +0 -3
  94. data/vendor/gems/express_templates/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  95. data/vendor/gems/express_templates/test/dummy/config/locales/en.yml +0 -23
  96. data/vendor/gems/express_templates/test/dummy/config/routes.rb +0 -4
  97. data/vendor/gems/express_templates/test/dummy/config/secrets.yml +0 -22
  98. data/vendor/gems/express_templates/test/dummy/config.ru +0 -4
  99. data/vendor/gems/express_templates/test/dummy/public/404.html +0 -67
  100. data/vendor/gems/express_templates/test/dummy/public/422.html +0 -67
  101. data/vendor/gems/express_templates/test/dummy/public/500.html +0 -66
  102. data/vendor/gems/express_templates/test/dummy/public/favicon.ico +0 -0
  103. data/vendor/gems/express_templates/test/dummy/test/controllers/hello_controller_test.rb +0 -14
  104. data/vendor/gems/express_templates/test/dummy/test/helpers/hello_helper_test.rb +0 -4
  105. data/vendor/gems/express_templates/test/express_templates_test.rb +0 -23
  106. data/vendor/gems/express_templates/test/handler_test.rb +0 -148
  107. data/vendor/gems/express_templates/test/indenter_test.rb +0 -27
  108. data/vendor/gems/express_templates/test/interpolator_test.rb +0 -80
  109. data/vendor/gems/express_templates/test/performance_test.rb +0 -97
  110. data/vendor/gems/express_templates/test/test_helper.rb +0 -178
  111. data/vendor/gems/foundation_apps_styles/Gemfile +0 -4
  112. data/vendor/gems/foundation_apps_styles/LICENSE.txt +0 -21
  113. data/vendor/gems/foundation_apps_styles/README.md +0 -41
  114. data/vendor/gems/foundation_apps_styles/Rakefile +0 -13
  115. data/vendor/gems/foundation_apps_styles/bin/console +0 -14
  116. data/vendor/gems/foundation_apps_styles/bin/setup +0 -7
  117. data/vendor/gems/foundation_apps_styles/foundation_apps_styles.gemspec +0 -24
  118. data/vendor/gems/foundation_apps_styles/lib/foundation_apps_styles/version.rb +0 -3
  119. data/vendor/gems/foundation_apps_styles/lib/foundation_apps_styles.rb +0 -6
  120. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/account.svg +0 -44
  121. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/action.svg +0 -38
  122. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/ban.svg +0 -17
  123. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/bell.svg +0 -22
  124. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/bookmark.svg +0 -14
  125. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/cart.svg +0 -35
  126. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/chevron.svg +0 -28
  127. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/circle-check.svg +0 -25
  128. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/circle-x.svg +0 -25
  129. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/cog.svg +0 -17
  130. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/comment-square.svg +0 -14
  131. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/dashboard.svg +0 -38
  132. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/document.svg +0 -28
  133. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/envelope.svg +0 -44
  134. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/flag.svg +0 -24
  135. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/home.svg +0 -28
  136. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/lock.svg +0 -55
  137. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/magnifying-glass.svg +0 -26
  138. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/person.svg +0 -62
  139. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/reload.svg +0 -19
  140. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/share-boxed.svg +0 -17
  141. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/star.svg +0 -14
  142. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/thumb.svg +0 -38
  143. data/vendor/gems/foundation_apps_styles/vendor/assets/iconic/zoom.svg +0 -56
  144. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/_global.scss +0 -131
  145. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/_includes.scss +0 -33
  146. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/_settings.scss +0 -614
  147. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_accordion.scss +0 -72
  148. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_action-sheet.scss +0 -265
  149. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_block-list.scss +0 -360
  150. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_button-group.scss +0 -197
  151. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_button.scss +0 -205
  152. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_card.scss +0 -93
  153. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_extras.scss +0 -54
  154. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_forms.scss +0 -460
  155. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_grid.scss +0 -422
  156. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_iconic.scss +0 -95
  157. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_label.scss +0 -134
  158. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_list.scss +0 -19
  159. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_menu-bar.scss +0 -382
  160. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_modal.scss +0 -129
  161. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_motion.scss +0 -525
  162. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_notification.scss +0 -207
  163. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_off-canvas.scss +0 -169
  164. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_panel.scss +0 -134
  165. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_popup.scss +0 -68
  166. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_switch.scss +0 -134
  167. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_tabs.scss +0 -100
  168. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_title-bar.scss +0 -135
  169. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_typography.scss +0 -345
  170. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/components/_utilities.scss +0 -160
  171. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/foundation-apps.css +0 -6146
  172. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/foundation.scss +0 -50
  173. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/helpers/_breakpoints.scss +0 -154
  174. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/helpers/_functions.scss +0 -343
  175. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/helpers/_images.scss +0 -19
  176. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/helpers/_mixins.scss +0 -123
  177. data/vendor/gems/foundation_apps_styles/vendor/assets/stylesheets/vendor/_normalize.scss +0 -424
@@ -1,129 +0,0 @@
1
- require 'test_helper'
2
- require 'ostruct'
3
- class SelectTest < ActiveSupport::TestCase
4
-
5
- def assigns
6
- {person: ::Person.new}
7
- end
8
-
9
- def helpers
10
- mock_action_view do
11
- def people_path
12
- '/people'
13
- end
14
- end
15
- end
16
-
17
-
18
- test "select requires a parent component" do
19
- assert_raises(RuntimeError) {
20
- html = arbre {
21
- select :gender, options: ['Male', 'Female'], selected: 'Male'
22
- }
23
- }
24
- end
25
-
26
- test "select comes with a label" do
27
- html = arbre {
28
- express_form(:person) {
29
- select :gender
30
- }
31
- }
32
- assert_match /<label.*for="person_gender"/, html
33
- end
34
-
35
- test "select generates correct options when values are specified as array" do
36
- html = arbre {
37
- express_form(:person) {
38
- select :gender, options: ['Male', 'Female'], selected: 'Male'
39
- }
40
- }
41
- assert_match /<option.*selected="selected" value="Male"/, html
42
- assert_match /<option.*value="Female"/, html
43
- end
44
-
45
- test "selected option is omitted selection is taken from model" do
46
- html = arbre {
47
- express_form(:person) {
48
- select :gender, options: ['Male', 'Female']
49
- }
50
- }
51
- assert_match /<option.*selected="selected" value="Male"/, html
52
- assert_match /<option.*value="Female"/, html
53
- end
54
-
55
- test "select generates options from data when options omitted" do
56
- html = arbre {
57
- express_form(:person) {
58
- select :city
59
- }
60
- }
61
- assert_match /<option.*selected="selected" value="San Francisco"/, html
62
- assert_match /<option.*value="Hong Kong"/, html
63
- end
64
-
65
- test "select uses options_from_collect... when field is relation" do
66
- html = arbre {
67
- express_form(:person) {
68
- select :gender_id
69
- }
70
- }
71
-
72
- assert_match /<option.*selected="selected" value="1"/, html
73
- assert_match /<option.*value="2"/, html
74
- end
75
-
76
- test "select defaults to include_blank: true" do
77
- html = arbre {
78
- express_form(:person) {
79
- select :gender
80
- }
81
- }
82
- assert_match '<option value=""></option>', html
83
- end
84
-
85
-
86
- test "select defaults can be overridden" do
87
- html = arbre {
88
- express_form(:person) {
89
- select :gender, include_blank: false
90
- }
91
- }
92
- assert_no_match 'include_blank: true', html
93
- end
94
-
95
- test "select multiple: true if passed multiple true" do
96
- html = arbre {
97
- express_form(:person) {
98
- select :taggings, include_blank: false, multiple: true
99
- }
100
- }
101
- assert_match 'multiple="multiple"', html
102
- end
103
-
104
- test "select multiple gets options from associated has_many_through collection" do
105
- html = arbre {
106
- express_form(:person) {
107
- select :taggings, include_blank: false, multiple: true
108
- }
109
- }
110
- assert_match 'tagging_ids', html
111
- assert_match /<option selected="selected" value="1">Friend<\/option>/, html
112
- assert_match /<option selected="selected" value="2">Enemy<\/option>/, html
113
- assert_match /<option value="3">Frenemy<\/option>/, html
114
- end
115
-
116
- test "select_collection works using collection_select" do
117
- html = arbre {
118
- express_form(:person) {
119
- select_collection :taggings
120
- }
121
- }
122
- assert_match 'tagging_ids', html
123
- assert_match /<option selected="selected" value="1">Friend<\/option>/, html
124
- assert_match /<option selected="selected" value="2">Enemy<\/option>/, html
125
- assert_match /<option value="3">Frenemy<\/option>/, html
126
- end
127
-
128
-
129
- end
@@ -1,36 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Stuff
4
- def self.columns
5
- []
6
- end
7
- end
8
-
9
- class SubmitTest < ActiveSupport::TestCase
10
-
11
- def assigns
12
- {resource: nil}
13
- end
14
- test "submit takes string param for value" do
15
- fragment = -> (ctx) {
16
- submit value: "Save it!"
17
- }
18
- assert_match '<div class="field-wrapper"><input type="submit" name="commit" value="Save it!" /></div>',
19
- arbre(&fragment)
20
- end
21
- test "submit accepts a class option" do
22
- fragment = -> (ctx) {
23
- submit class: 'button'
24
- }
25
- assert_match '<div class="field-wrapper"><input type="submit" name="commit" value="Save" class="button" /></div>',
26
- arbre(&fragment)
27
- end
28
- test "submit accepts a value and class option" do
29
- fragment = -> (ctx) {
30
- submit value: 'XYZ', class: 'button'
31
- }
32
- assert_match '<div class="field-wrapper"><input type="submit" name="commit" value="XYZ" class="button" /></div>',
33
- arbre(&fragment)
34
- end
35
-
36
- end
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
- require 'ostruct'
3
-
4
- class TreeForTest < ActiveSupport::TestCase
5
-
6
- class Role
7
- attr :name, :children
8
- def initialize(name, children: [])
9
- @name = name
10
- @children = children
11
- end
12
- end
13
-
14
- def roles
15
- @roles ||= [Role.new('SuperAdmin', children:
16
- [Role.new('Admin', children:
17
- [Role.new('Publisher', children:
18
- [Role.new('Author')]),
19
- Role.new('Auditor')])])]
20
- end
21
-
22
- EXAMPLE_MARKUP = <<-HTML
23
- <ul class="tree-for tree roles" id="roles">
24
- <li>
25
- SuperAdmin
26
- <ul>
27
- <li>
28
- Admin
29
- <ul>
30
- <li>
31
- Publisher
32
- <ul>
33
- <li>Author</li>
34
- </ul>
35
- </li>
36
- <li>Auditor</li>
37
- </ul>
38
- </li>
39
- </ul>
40
- </li>
41
- </ul>
42
- HTML
43
-
44
- def assigns
45
- {roles: roles}
46
- end
47
-
48
- def simple_tree_for
49
- arbre {
50
- tree_for(:roles)
51
- }.to_s
52
- end
53
-
54
- test "tree_for renders correct markup with node.name as default" do
55
- assert_equal EXAMPLE_MARKUP, simple_tree_for
56
- end
57
-
58
- def custom_tree_for
59
- arbre {
60
- tree_for(:roles) { |node|
61
- text_node node.name.upcase
62
- }
63
- }
64
- end
65
-
66
- test "tree_for accepts block with custom content" do
67
- assert_match 'AUTHOR', custom_tree_for
68
- end
69
-
70
- end
@@ -1,90 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ProcTest < ActiveSupport::TestCase
4
-
5
- def return_block(lambda = nil, &block)
6
- return block || lambda
7
- end
8
-
9
- test "#source returns a proc's source" do
10
- block = return_block { |f|
11
- do_something
12
- }
13
- assert_equal "{ |f|\n do_something\n }", block.source
14
- end
15
-
16
- test "#source works with a do block" do
17
- block = return_block do |f|
18
- do_something
19
- end
20
-
21
- assert_equal "do |f|\n do_something\n end", block.source
22
- end
23
-
24
- test "#source works with a single line block" do
25
- block = return_block { whatever }
26
- assert_equal '{ whatever }', block.source
27
- end
28
-
29
- test "#source works with a block containing a block" do
30
- block = return_block { whatever { another } }
31
- assert_equal '{ whatever { another } }', block.source
32
- end
33
-
34
- test "#source works with a stabby lambda" do
35
- block = return_block -> (something) { whatever }
36
- assert_equal '-> (something) { whatever }', block.source
37
- end
38
-
39
- test "#source work with a stabby lambda spanning lines" do
40
- block = return_block -> {
41
- whatever { foo }
42
- }
43
- assert_equal "-> {\n whatever { foo }\n}", block.source
44
- end
45
-
46
- test "#source_body returns the body of a proc" do
47
- block = return_block -> { whatever }
48
- assert_equal 'whatever', block.source_body
49
- end
50
-
51
- test "#source_body handles funky bodies" do
52
- block = return_block do
53
- something(funky) &-> { whatever }
54
- end
55
- assert_equal 'something(funky) &-> { whatever }', block.source_body
56
- end
57
-
58
- test "#source body raises exception for arity > 0" do
59
- block = return_block -> (foo) { whatever }
60
- assert_raises(RuntimeError) do
61
- block.source_body
62
- end
63
- end
64
-
65
- test ".from_source stores source of a dynamicly built proc for later inspection" do
66
- src = "-> { 'foo' }"
67
- assert_equal src, Proc.from_source(src).source
68
- assert_equal 'foo', Proc.from_source(src).call
69
- end
70
-
71
- test "#source_body captures full body when parens around parameters not provided" do
72
- block = return_block { something(:one, "two") }
73
- assert_equal 'something(:one, "two")', block.source_body
74
- block = return_block -> { something :one, "two" }
75
- assert_equal 'something :one, "two"', block.source_body
76
- # TODO: Fix this
77
- # block = return_block { something :one, "two" }
78
- # assert_equal 'something :one, "two"', block.source_body
79
- end
80
-
81
- def return_proc_value(*args, options)
82
- options.values.first.values.first
83
- end
84
-
85
- test "#source works when a proc is inside a hash literal" do
86
- block = return_proc_value(:one, two: {a: -> {'proc_inside'}})
87
- assert_equal "-> {'proc_inside'}", block.source
88
- end
89
-
90
- end
@@ -1,20 +0,0 @@
1
- require 'test_helper'
2
-
3
- class StringTest < ActiveSupport::TestCase
4
- def string
5
- "@resource.something"
6
- end
7
-
8
- test "String#to_view_code returns the string" do
9
- assert_equal string, string.to_view_code
10
- end
11
-
12
- test "String#inspect works normally when #to_view_code hasn't been called" do
13
- assert_equal %Q("#{string}"), string.inspect
14
- end
15
-
16
- test "String#to_view_code causes subsequent #inspect to remove quotes" do
17
- assert_equal string, string.to_view_code.inspect
18
- end
19
-
20
- end
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,5 +0,0 @@
1
- class HelloController < ApplicationController
2
- def show
3
- @hello = "Hi there"
4
- end
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,6 +0,0 @@
1
- content_for :title, "Dummy Show"
2
-
3
- div {
4
- h1 "#{hello}"
5
- p 'Find me in app/views/hello/show.html.express_templates'
6
- }
@@ -1,15 +0,0 @@
1
- html(lang: "en") {
2
- head {
3
- meta charset: 'utf-8'
4
- meta name: 'viewport', content: "width=device-width, initial-scale=1.0"
5
- title {
6
- content_for(:title)
7
- }
8
- stylesheet_link_tag "application", media: 'all', 'data-turbolinks-track' => true
9
- csrf_meta_tags
10
- }
11
- body {
12
- yield
13
- }
14
- javascript_include_tag "application"
15
- }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,26 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require "action_controller/railtie"
4
- require "action_mailer/railtie" # should be able to remove this too, but no.
5
- require "sprockets/railtie"
6
- require "rails/test_unit/railtie"
7
-
8
- Bundler.require(*Rails.groups)
9
- require "express_templates"
10
-
11
- module Dummy
12
- class Application < Rails::Application
13
- # Settings in config/environments/* take precedence over those specified here.
14
- # Application configuration should go into files in config/initializers
15
- # -- all .rb files in that directory are automatically loaded.
16
-
17
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
18
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
19
- # config.time_zone = 'Central Time (US & Canada)'
20
-
21
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
22
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
23
- # config.i18n.default_locale = :de
24
- end
25
- end
26
-
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,37 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations.
23
- # config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
-
30
- # Adds additional error checking when serving assets at runtime.
31
- # Checks for improperly declared sprockets dependencies.
32
- # Raises helpful error messages.
33
- config.assets.raise_runtime_errors = true
34
-
35
- # Raises error for missing translations
36
- # config.action_view.raise_on_missing_translations = true
37
- end
@@ -1,82 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both threaded web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # `config.assets.precompile` has moved to config/initializers/assets.rb
36
-
37
- # Specifies the header that your server uses for sending files.
38
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
39
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
-
41
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42
- # config.force_ssl = true
43
-
44
- # Set to :debug to see everything in the log.
45
- config.log_level = :info
46
-
47
- # Prepend all log lines with the following tags.
48
- # config.log_tags = [ :subdomain, :uuid ]
49
-
50
- # Use a different logger for distributed setups.
51
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
52
-
53
- # Use a different cache store in production.
54
- # config.cache_store = :mem_cache_store
55
-
56
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
57
- # config.action_controller.asset_host = "http://assets.example.com"
58
-
59
- # Precompile additional assets.
60
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
61
- # config.assets.precompile += %w( search.js )
62
-
63
- # Ignore bad email addresses and do not raise email delivery errors.
64
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
- # config.action_mailer.raise_delivery_errors = false
66
-
67
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
- # the I18n.default_locale when a translation cannot be found).
69
- config.i18n.fallbacks = true
70
-
71
- # Send deprecation notices to registered listeners.
72
- config.active_support.deprecation = :notify
73
-
74
- # Disable automatic flushing of the log to improve performance.
75
- # config.autoflush_log = false
76
-
77
- # Use default logging formatter so that PID and timestamp are not suppressed.
78
- config.log_formatter = ::Logger::Formatter.new
79
-
80
- # Do not dump schema after migrations.
81
- config.active_record.dump_schema_after_migration = false
82
- end
@@ -1,40 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
-
37
- # Raises error for missing translations
38
- # config.action_view.raise_on_missing_translations = true
39
- config.active_support.test_order = :sorted
40
- end
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Precompile additional assets.
7
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
8
- # Rails.application.config.assets.precompile += %w( search.js )
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.action_dispatch.cookies_serializer = :json