eitil 1.2.4 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/eitil_core/README.md +31 -0
  3. data/eitil_core/lib/eitil_core/string/colorize.rb +30 -0
  4. data/eitil_core/lib/eitil_core/string.rb +1 -0
  5. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb +3 -1
  6. data/eitil_integrate/lib/eitil_integrate/application_exporter/initialize.rb +2 -0
  7. data/eitil_integrate/lib/eitil_integrate/application_exporter/style_cells.rb +5 -0
  8. data/eitil_wrapper/lib/eitil_wrapper/callbacks/helper_methods.rb +8 -1
  9. data/eitil_wrapper/lib/eitil_wrapper/decorators/application_decorator.rb +3 -0
  10. data/eitil_wrapper/lib/eitil_wrapper/decorators/controller_decorator.rb +7 -2
  11. data/eitil_wrapper/lib/eitil_wrapper/scopes/default_scopes.rb +8 -1
  12. data/lib/eitil/version.rb +1 -1
  13. data/spec/dummy_app/Rakefile +6 -0
  14. data/spec/dummy_app/app/assets/config/manifest.js +4 -0
  15. data/spec/dummy_app/app/assets/javascripts/application.js +15 -0
  16. data/spec/dummy_app/app/assets/javascripts/cable.js +13 -0
  17. data/spec/dummy_app/app/assets/stylesheets/addresses.css +4 -0
  18. data/spec/dummy_app/app/assets/stylesheets/application.css +15 -0
  19. data/spec/dummy_app/app/assets/stylesheets/scaffold.css +80 -0
  20. data/spec/dummy_app/app/assets/stylesheets/users.css +4 -0
  21. data/spec/dummy_app/app/channels/application_cable/channel.rb +4 -0
  22. data/spec/dummy_app/app/channels/application_cable/connection.rb +4 -0
  23. data/spec/dummy_app/app/controllers/addresses_controller.rb +58 -0
  24. data/spec/dummy_app/app/controllers/application_controller.rb +5 -0
  25. data/spec/dummy_app/app/controllers/users_controller.rb +93 -0
  26. data/spec/dummy_app/app/decorators/address_decorator.rb +3 -0
  27. data/spec/dummy_app/app/decorators/application_decorator.rb +12 -0
  28. data/spec/dummy_app/app/decorators/user_decorator.rb +19 -0
  29. data/spec/dummy_app/app/helpers/addresses_helper.rb +2 -0
  30. data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
  31. data/spec/dummy_app/app/helpers/users_helper.rb +2 -0
  32. data/spec/dummy_app/app/jobs/application_job.rb +2 -0
  33. data/spec/dummy_app/app/mailers/application_mailer.rb +4 -0
  34. data/spec/dummy_app/app/models/address.rb +5 -0
  35. data/spec/dummy_app/app/models/application_record.rb +8 -0
  36. data/spec/dummy_app/app/models/user.rb +30 -0
  37. data/spec/dummy_app/app/views/addresses/_form.html.erb +17 -0
  38. data/spec/dummy_app/app/views/addresses/edit.html.erb +6 -0
  39. data/spec/dummy_app/app/views/addresses/index.html.erb +25 -0
  40. data/spec/dummy_app/app/views/addresses/new.html.erb +5 -0
  41. data/spec/dummy_app/app/views/addresses/show.html.erb +4 -0
  42. data/spec/dummy_app/app/views/layouts/application.html.erb +15 -0
  43. data/spec/dummy_app/app/views/layouts/mailer.html.erb +13 -0
  44. data/spec/dummy_app/app/views/layouts/mailer.text.erb +1 -0
  45. data/spec/dummy_app/app/views/users/_form.html.erb +17 -0
  46. data/spec/dummy_app/app/views/users/edit.html.erb +6 -0
  47. data/spec/dummy_app/app/views/users/index.html.erb +25 -0
  48. data/spec/dummy_app/app/views/users/new.html.erb +5 -0
  49. data/spec/dummy_app/app/views/users/show.html.erb +4 -0
  50. data/spec/dummy_app/bin/bundle +3 -0
  51. data/spec/dummy_app/bin/rails +4 -0
  52. data/spec/dummy_app/bin/rake +4 -0
  53. data/spec/dummy_app/bin/setup +36 -0
  54. data/spec/dummy_app/bin/update +31 -0
  55. data/spec/dummy_app/bin/yarn +11 -0
  56. data/spec/dummy_app/config/application.rb +16 -0
  57. data/spec/dummy_app/config/boot.rb +5 -0
  58. data/spec/dummy_app/config/cable.yml +10 -0
  59. data/spec/dummy_app/config/database.yml +25 -0
  60. data/spec/dummy_app/config/environment.rb +11 -0
  61. data/spec/dummy_app/config/environments/development.rb +61 -0
  62. data/spec/dummy_app/config/environments/production.rb +94 -0
  63. data/spec/dummy_app/config/environments/test.rb +46 -0
  64. data/spec/dummy_app/config/initializers/application_controller_renderer.rb +8 -0
  65. data/spec/dummy_app/config/initializers/assets.rb +14 -0
  66. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  67. data/spec/dummy_app/config/initializers/content_security_policy.rb +25 -0
  68. data/spec/dummy_app/config/initializers/cookies_serializer.rb +5 -0
  69. data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/spec/dummy_app/config/initializers/inflections.rb +16 -0
  71. data/spec/dummy_app/config/initializers/mime_types.rb +4 -0
  72. data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  73. data/spec/dummy_app/config/locales/en.yml +33 -0
  74. data/spec/dummy_app/config/puma.rb +34 -0
  75. data/spec/dummy_app/config/routes.rb +12 -0
  76. data/spec/dummy_app/config/spring.rb +6 -0
  77. data/spec/dummy_app/config/storage.yml +34 -0
  78. data/spec/dummy_app/config.ru +5 -0
  79. data/spec/dummy_app/db/development.sqlite3 +0 -0
  80. data/spec/dummy_app/db/migrate/20210907114344_create_users.rb +12 -0
  81. data/spec/dummy_app/db/migrate/20210907114557_create_addresses.rb +16 -0
  82. data/spec/dummy_app/db/migrate/20210907131339_add_multiple_columns_to_user.rb +8 -0
  83. data/spec/dummy_app/db/schema.rb +41 -0
  84. data/spec/dummy_app/db/test.sqlite3 +0 -0
  85. data/spec/dummy_app/log/decorator_log.log +42 -0
  86. data/spec/dummy_app/log/development.log +24 -0
  87. data/spec/dummy_app/log/test.log +0 -0
  88. data/spec/dummy_app/package.json +5 -0
  89. data/spec/dummy_app/public/404.html +67 -0
  90. data/spec/dummy_app/public/422.html +67 -0
  91. data/spec/dummy_app/public/500.html +66 -0
  92. data/spec/dummy_app/public/apple-touch-icon-precomposed.png +0 -0
  93. data/spec/dummy_app/public/apple-touch-icon.png +0 -0
  94. data/spec/dummy_app/public/favicon.ico +0 -0
  95. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/2j/2jWL-rhQuwDjyPsAqfz1_wB_H15Kk2ODQ2dAu-XZKx8.cache +1 -0
  96. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/6x/6x9nAtWMtOljHkcAvx9LS3_kzIpD7XoM5jqwKXqN8SU.cache +1 -0
  97. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/7f/7fMKshWzk4gJEbG0FTuuuHVOeF6BG9SoIx1X0yGN4XA.cache +1 -0
  98. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/8-/8-O-UfzZVhbu8Cty_FaH4c3xNM-Sm6U90BGLWmTPpSo.cache +1 -0
  99. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/8a/8a5JUS7sZRAe1CpAiN0iy1n_apTjx0H3rkPqGgg_HHs.cache +1 -0
  100. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/9E/9EI_Wtkx262NF6vdNPozRjkOmUgT5wcyMxwPhhok91Y.cache +1 -0
  101. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Au/AutOawEb2V5QIxVjqKqmRFpvJ3BHEJvFMIphdZydKPY.cache +0 -0
  102. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/BZ/BZULOBoPeioJ3yr_GDNL-cF1brDPreCMd34hrDbHvX4.cache +0 -0
  103. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/CS/CSs23ds7URW15l5Z5w3b3A6CPJS5ODsgzz0mmAHULF0.cache +1 -0
  104. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Eu/EuFZYEzbxGLRX803DDnrfKQPcMoGo5ITR-9VuBY_35Q.cache +0 -0
  105. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FL/FLU4EKYSshHlQjgOqP6RDQ8z7GTRbHhl-2IBWvv363s.cache +0 -0
  106. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/FL/FLl0vmABYcwCTORqhZlx9KLVZvAw1Sic_8-Vs5Q7F3I.cache +0 -0
  107. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/KF/KFlEJcPYkMbf3yhDJTUJ73BpWJ8BMzjQUhpLO1CZqUk.cache +1 -0
  108. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LN/LNUl7yichb1dUbkovvnOVoVxkVQnhwndYgJRJwoXO_k.cache +1 -0
  109. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/LU/LUq0pj8f6-F5P5ZpVil-_pBLCVTYTqa-qRzQOVFkgGg.cache +1 -0
  110. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/N7/N7Q7f6mqtpX5Lxh78v1mILszsC6Oi9hrt9E8bYTCUg8.cache +0 -0
  111. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/OJ/OJX-7cXh407miinHDx7z55OnuYnifbaiCSjus3I2ETg.cache +0 -0
  112. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/P-/P-WGZR_jmbgi7zjScSIzMbnxmPRhR0FG-sUCbx-W0jA.cache +1 -0
  113. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Qd/QdDsJNHB1T-o6r9B1zTqkZ6nDWfFlq7i5HIqxsMqOR8.cache +1 -0
  114. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Qv/QvPvnJIjqHAUeoUdS4dpH_JVRh4znkA7ig3VHz7onhE.cache +1 -0
  115. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/RG/RG1PrmlixwaUlG8BV0kcm_3F7OQekxsrLYjBdf403-k.cache +2 -0
  116. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/TE/TEmdPmCEnqBmIu10fP0G66B333eV_jj1DT6NEM9BY5U.cache +1 -0
  117. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/XM/XMyLLsxd032ZvSGR9P5BcOxAXuQxt_wuaTVdjeuYUeU.cache +0 -0
  118. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/Xn/XnnrCKCkM_Fa5bHMwSjQ_NTBPicUoSK3LOeYu-ZmpYo.cache +0 -0
  119. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/cj/cjpKTBCb00-jq6B1KoFGJrP4kvsl8JACc_pqZAORMlM.cache +0 -0
  120. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/ft/ftREOVuSBdqj0d189uIhUmNEThLHS0nXTyt34tl_G9g.cache +0 -0
  121. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iD/iDTnVSbZnIij5Xm4jkwCyIXAPDn8RwaRe5Ja8YPKibw.cache +0 -0
  122. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iU/iU5Zc6hQ2jwcmv6lE2L4aWBJHHMnS1vrh0_LHR574kw.cache +1 -0
  123. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/iZ/iZjLEYDTYhysPjIEb36PhNErZ4rRW1BniBfuH7oa1RI.cache +0 -0
  124. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/ke/keL0ZyrZtXqgSINKKBK3qFEd2fvJSrv8qgU78i1-aqY.cache +1 -0
  125. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
  126. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
  127. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/pa/pas5TN2JG4i2AUMntaZrRkOZ_AZhFBtsfPaUHKOSdnM.cache +0 -0
  128. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
  129. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/uQ/uQImR-NTBFCJ7TsnJRrKAG0zhTcX7vpg_MFvTWvWSGQ.cache +1 -0
  130. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/uo/uosY6jh1_W3cVpcoQY0hcgG2zDeTVR169am2REYxMtI.cache +0 -0
  131. data/spec/dummy_app/tmp/cache/assets/sprockets/v4.0.0/yk/ykwP8uOyoTr4wPoEUoyB6Lrx9BG_9mWl6in8AJzBGPw.cache +1 -0
  132. data/spec/dummy_app/tmp/development_secret.txt +1 -0
  133. data/spec/dummy_app/tmp/restart.txt +0 -0
  134. data/spec/eitil_core/argument_helpers/all_args_to_ivars_bang_spec.rb +1 -1
  135. data/spec/eitil_core/argument_helpers/all_args_to_ivars_spec.rb +1 -1
  136. data/spec/eitil_core/argument_helpers/all_kwargs_to_ivars_bang_spec.rb +1 -1
  137. data/spec/eitil_core/argument_helpers/all_kwargs_to_ivars_spec.rb +1 -1
  138. data/spec/eitil_core/argument_helpers/args_to_h_bang_spec.rb +1 -1
  139. data/spec/eitil_core/argument_helpers/args_to_h_spec.rb +1 -1
  140. data/spec/eitil_core/argument_helpers/args_to_ivars_bang_spec.rb +1 -1
  141. data/spec/eitil_core/argument_helpers/args_to_ivars_spec.rb +1 -1
  142. data/spec/eitil_core/array/map_strings_spec.rb +2 -2
  143. data/spec/eitil_core/array/slice_hashes_spec.rb +1 -1
  144. data/spec/eitil_core/datetime/prettify_spec.rb +1 -1
  145. data/spec/eitil_core/errors/raise_error_spec.rb +1 -1
  146. data/spec/eitil_core/float/safe_to_i_spec.rb +1 -1
  147. data/spec/eitil_core/formatters/duck_set_spec.rb +3 -3
  148. data/spec/eitil_core/formatters/sql_spec.rb +3 -3
  149. data/spec/eitil_core/hash/auto_dig_spec.rb +1 -1
  150. data/spec/eitil_core/hash/transform_string_values_spec.rb +2 -2
  151. data/spec/eitil_core/safe_executions/safe_call.rb +1 -1
  152. data/spec/eitil_core/safe_executions/safe_send.rb +1 -1
  153. data/spec/eitil_core/setters/set_ivars_spec.rb +1 -1
  154. data/spec/eitil_core/string/colorize_spec.rb +91 -0
  155. data/spec/eitil_core/string/strip_base64_header_spec.rb +1 -1
  156. data/spec/eitil_core/string/to_filename_spec.rb +1 -1
  157. data/spec/eitil_core/type_checkers/is_num_or_nan_spec.rb +1 -1
  158. data/spec/eitil_integrate/application_exporter/auto_sum_spec.rb +106 -0
  159. data/spec/eitil_integrate/application_exporter/initialize_spec.rb +28 -0
  160. data/spec/eitil_wrapper/callbacks/helper_methods_spec.rb +34 -0
  161. data/spec/eitil_wrapper/decorators/decorators_spec.rb +49 -0
  162. data/spec/eitil_wrapper/jobs/single_method_job_spec.rb +72 -0
  163. data/spec/eitil_wrapper/routes/extended_resources_spec.rb +16 -0
  164. data/spec/eitil_wrapper/scopes/default_scopes_spec.rb +154 -0
  165. data/spec/spec_helper.rb +16 -6
  166. metadata +176 -4
@@ -1,5 +1,5 @@
1
1
 
2
- RSpec.describe "#is_num? and #is_nan?" do
2
+ RSpec.describe "EitilCore #is_num? and #is_nan?" do
3
3
 
4
4
  context "for String" do
5
5
 
@@ -0,0 +1,106 @@
1
+
2
+ require "eitil_integrate/application_exporter"
3
+
4
+ RSpec.describe "EitilIntegrate::RubyXL::AutoSum" do
5
+
6
+ let(:input) do
7
+ {
8
+ 0 =>["Cafe eitje, geëxporteerd op maandag 6 sept. 2021",nil,"01/06/2021 – 30/06/2021","",nil,"Abel van Hoek","Astrid Spanjers","Billy Wilson","Hannah Broek","Joris Rood (12345678)","Lara Welting ()","Mascha de Graaf","Merel Verkaart","Sara Brouwer","Tammy Warren","Walter Watson"],
9
+ 1 =>[nil, nil, nil, "Gewerkte uren", nil, "92,75", "0,0", "94,75", "0,0", "0,0", "0,0", "0,0", "38,75", "0,0", "0,0", "0,0"],
10
+ 2 =>[nil, nil, nil, "Verlof opgenomen", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
11
+ 3 =>[nil, nil, nil, "Ziekte-uren", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
12
+ 4 =>[nil, nil, nil, "Bijzonder verlof", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
13
+ 5 =>[nil, nil, nil, "Totaal maaltijden", nil, "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"],
14
+ 6 =>[nil, nil, nil, "Toeslag: Alle dagen (18:00-23:59)", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
15
+ 7 =>[nil, nil, nil, "Toeslag: Shiftleader toeslag", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
16
+ 8 =>[nil, nil, nil, "Toeslag: Feestdagen", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
17
+ 9 =>[nil, nil, nil, "Toeslag: Feestdagen", nil, "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0", "0,0"],
18
+ 10=>[nil, nil, nil, "01/06/2021", nil, "", "", "", "", "", "", "", "7,75", "", "", ""],
19
+ 11=>[nil, nil, nil, "02/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
20
+ 12=>[nil, nil, nil, "03/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
21
+ 13=>[nil, nil, nil, "04/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
22
+ 14=>[nil, nil, nil, "05/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
23
+ 15=>[nil, nil, nil, "06/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
24
+ 16=>[nil, nil, nil, "07/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
25
+ 17=>[nil, nil, nil, "08/06/2021", nil, "", "", "", "", "", "", "", "7,75", "", "", ""],
26
+ 18=>[nil, nil, nil, "09/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
27
+ 19=>[nil, nil, nil, "10/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
28
+ 20=>[nil, nil, nil, "11/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
29
+ 21=>[nil, nil, nil, "12/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
30
+ 22=>[nil, nil, nil, "13/06/2021", nil, "", "", "8,5", "", "", "", "", "", "", "", ""],
31
+ 23=>[nil, nil, nil, "14/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
32
+ 24=>[nil, nil, nil, "15/06/2021", nil, "", "", "", "", "", "", "", "7,75", "", "", ""],
33
+ 25=>[nil, nil, nil, "16/06/2021", nil, "7,5", "", "", "", "", "", "", "", "", "", ""],
34
+ 26=>[nil, nil, nil, "17/06/2021", nil, "", "", "7,75", "", "", "", "", "", "", "", ""],
35
+ 27=>[nil, nil, nil, "18/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
36
+ 28=>[nil, nil, nil, "19/06/2021", nil, "7,75", "", "", "", "", "", "", "", "", "", ""],
37
+ 29=>[nil, nil, nil, "20/06/2021", nil, "10:00", "10:00", "00:15", "00:15", "7", ""], # sum test
38
+ 30=>[nil, nil, nil, "21/06/2021", nil, "10:00", "10:00", "00:15", "00:15", "", "", ""], # sum test
39
+ 31=>[nil, nil, nil, "22/06/2021", nil, "7,0", "", "", "", "", "", "", "", "", "", ""], # rounding test
40
+ 32=>[nil, nil, nil, "23/06/2021", nil, "7,1", "", "", "", "", "", "", "", "", "", ""], # rounding test
41
+ 33=>[nil, nil, nil, "24/06/2021", nil, 7, 7.5, "7,5", "7", "7.5", "", "", "", "", ""], # sum test
42
+ 34=>[nil, nil, nil, "25/06/2021", nil, 7, 7, 7, "", "", "", "", "", "", "", ""], # sum test
43
+ 35=>[nil, nil, nil, "26/06/2021", nil, 7.5, 7.5, 7.5, "", "", "", "", "", "", "", ""], # sum test
44
+ 36=>[nil, nil, nil, "27/06/2021", nil, "7", "7", "7", "", "", "", "", "", "", "", ""], # sum test
45
+ 37=>[nil, nil, nil, "28/06/2021", nil, "7.5", "7.5", "7.5", "", "", "", "", "", "", ""], # sum test
46
+ 38=>[nil, nil, nil, "29/06/2021", nil, "7,5", "7,5", "7,5", "", "", "", "", "", ""], # sum test
47
+ 39=>[nil, nil, nil, "30/06/2021", nil, "", "", "", "", "", "", "", "", "", "", ""] # nil test
48
+ }
49
+ end
50
+
51
+ let(:autosum) { EitilIntegrate::RubyXL::AutoSum.perform(input) }
52
+
53
+ it "should reduce all columns (represented as arrays) into a single string or nil" do
54
+ expect(autosum).to be_a Hash
55
+ expect(autosum.values).to be_a Array
56
+ expect(autosum.values.all? { |v| v.is_a?(String) || v.is_a?(NilClass) }).to be_truthy
57
+ end
58
+
59
+ it "should sum integers correctly" do
60
+ expect(autosum[34]).to eq "21"
61
+ end
62
+
63
+ it "should sum floats correctly" do
64
+ expect(autosum[35]).to eq "22.5"
65
+ end
66
+
67
+ it "should sum stringified integers (e.g. '7') correctly" do
68
+ expect(autosum[36]).to eq "21"
69
+ end
70
+
71
+ it "should sum stringified floats (e.g. '7.5') correctly" do
72
+ expect(autosum[37]).to eq "22.5"
73
+ end
74
+
75
+ it "should sum stringified comma floats (e.g. '7,5') correctly" do
76
+ expect(autosum[38]).to eq "22.5"
77
+ end
78
+
79
+ it "should sum stringified times (e.g. '10:00') correctly" do
80
+ expect(autosum[30]).to eq "20:30"
81
+ end
82
+
83
+ it "should sum a combination of all different numeric formats correctly" do
84
+ expect(autosum[33]).to eq "36.5"
85
+ end
86
+
87
+ it "should not sum a combination of a numeric format and time format,
88
+ but return nil instead" do
89
+ expect(autosum[29]).to be_nil
90
+ end
91
+
92
+ it "should convert summed floats into integers,
93
+ if the number is whole and therefore could be represented as integer" do
94
+ expect(autosum[31]).to eq "7"
95
+ end
96
+
97
+ it "should not convert summed floats into integers,
98
+ if the number is not whole and therefore could not be represented as integer" do
99
+ expect(autosum[32]).to eq "7.1"
100
+ end
101
+
102
+ it "should replace the first column's values with a title called 'Totaal'" do
103
+ expect(autosum[0]).to eq 'Totaal'
104
+ end
105
+
106
+ end
@@ -0,0 +1,28 @@
1
+
2
+ RSpec.describe "EitilIntegrate::RubyXL::ApplicationExporter.new" do
3
+
4
+ let(:exporter) do
5
+ EitilIntegrate::RubyXL::ApplicationExporter.new(start_date: '01-01-2020', end_date: '01-03-2020')
6
+ end
7
+
8
+ it "should convert the string arguments :start_date and :end_date into Date objects" do
9
+ expect(exporter.start_date).to be_a Date
10
+ expect(exporter.end_date).to be_a Date
11
+ end
12
+
13
+ it "should create a :date_range accessor" do
14
+ expect(exporter.date_range).to be_a Range
15
+ expect(exporter.date_range.first).to be_a Date
16
+ end
17
+
18
+ it "should create a RubyXL::Workbook and RubyXL::Worksheet" do
19
+ expect(exporter.book).to be_a RubyXL::Workbook
20
+ expect(exporter.sheet).to be_a RubyXL::Worksheet
21
+ end
22
+
23
+ it "should set the X and Y coordinates to 0" do
24
+ expect(exporter.x).to eq 0
25
+ expect(exporter.y).to eq 0
26
+ end
27
+
28
+ end
@@ -0,0 +1,34 @@
1
+
2
+ RSpec.describe "EitilWrapper::Callbacks" do
3
+
4
+ let(:callbacks) { User.instance_methods(false) }
5
+
6
+ context "for columns of datatype: boolean" do
7
+
8
+ it "should create the callback .{column_name}_became_true" do
9
+ expect(callbacks).to include(:confirmed_became_true)
10
+ end
11
+
12
+ it "should create the callback .{column_name}_becomes_true" do
13
+ expect(callbacks).to include(:confirmed_becomes_true)
14
+ end
15
+
16
+ it "should create the callback .{column_name}_to_true (works for both become and became)" do
17
+ expect(callbacks).to include(:confirmed_to_true)
18
+ end
19
+
20
+ it "should create the callback .{column_name}_became_false" do
21
+ expect(callbacks).to include(:confirmed_became_false)
22
+ end
23
+
24
+ it "should create the callback .{column_name}_becomes_false" do
25
+ expect(callbacks).to include(:confirmed_becomes_false)
26
+ end
27
+
28
+ it "should create the callback .{column_name}_to_false (works for both become and became)" do
29
+ expect(callbacks).to include(:confirmed_to_false)
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,49 @@
1
+
2
+ RSpec.describe "EitilWrapper::Decorators" do
3
+
4
+ include Rack::Test::Methods
5
+
6
+ let(:user) { User.create(first_name: 'slim', last_name: 'shady') }
7
+
8
+ def body(endpoint)
9
+ @body ||= JSON.parse(get("/users/#{user.id}/#{endpoint}").body)
10
+ end
11
+
12
+ it "should respond to a request" do
13
+ response = get "/users/#{user.id}/decorator_a"
14
+ expect(response).to be_a Rack::MockResponse
15
+ end
16
+
17
+ it "should, by default, return all of a records' columns" do
18
+ response_keys = body(:decorator_a).keys.map(&:to_sym)
19
+ table_columns = [:id, :created_at, :updated_at, :first_name, :last_name, :email, :birthday, :phone, :confirmed, :last_sign_in, :age, :wage]
20
+ expect(table_columns.all? { |column| response_keys.include?(column) }).to be_truthy
21
+ end
22
+
23
+ it "should, if a specific decorator method is passed, return that method's value" do
24
+ response_keys = body(:decorator_b).keys.map(&:to_sym)
25
+ decorator_keys = [:first_name, :last_name]
26
+ expect(response_keys).to eq decorator_keys
27
+ end
28
+
29
+ it "should, if no decorator method is passed, but param['isMobile'] is present, return the :app method's value" do
30
+ response = post "/users/#{user.id}/decorator_c", { "isMobile" => true }
31
+ response_keys = JSON.parse(response.body).keys.map(&:to_sym)
32
+ decorator_keys = [:phone, :email]
33
+ expect(response_keys).to eq decorator_keys
34
+ end
35
+
36
+ it "should, if no decorator method is passed, but param['isWeb'] is present, return the :web method's value" do
37
+ response = post "/users/#{user.id}/decorator_c", { "isWeb" => true }
38
+ response_keys = JSON.parse(response.body).keys.map(&:to_sym)
39
+ decorator_keys = [:age, :wage]
40
+ expect(response_keys).to eq decorator_keys
41
+ end
42
+
43
+ it "should, if a decorator class is passed, return the value of that class' method" do
44
+ response_keys = body(:decorator_d).keys.map(&:to_sym)
45
+ decorator_keys = [:created_at, :updated_at]
46
+ expect(response_keys).to eq decorator_keys
47
+ end
48
+
49
+ end
@@ -0,0 +1,72 @@
1
+
2
+ RSpec.describe "EitilWrapper::Jobs" do
3
+
4
+ let(:user) { User.create(first_name: "Donald", last_name: "Duck") }
5
+
6
+ it "should create a new method, if the new_job (perform_later) is used for a singleton method" do
7
+ expect(User.methods).to include(:this_is_a_singleton_method_job)
8
+ end
9
+
10
+ it "should create a new method, if the new_job (perform_later) is used for an instance method" do
11
+ expect(User.instance_methods).to include(:this_is_an_instance_method_job)
12
+ end
13
+
14
+ it "should create a new method, if the new_job_now (perform_now) is used for a singleton method" do
15
+ expect(User.methods).to include(:this_is_a_singleton_method_job_now)
16
+ end
17
+
18
+ it "should create a new method, if the new_job_now (perform_now) is used for an instance method" do
19
+ expect(User.instance_methods).to include(:this_is_an_instance_method_job_now)
20
+ end
21
+
22
+ it "should allow us to perform the created singleton perform_later method" do
23
+ begin
24
+ User.this_is_a_singleton_method_job
25
+ status = 'passed'
26
+ rescue
27
+ status = 'failed'
28
+ end
29
+ expect(status).to eq 'passed'
30
+ end
31
+
32
+ it "should allow us to perform the created instance perform_later method" do
33
+ begin
34
+ user.this_is_an_instance_method_job
35
+ status = 'passed'
36
+ rescue
37
+ status = 'failed'
38
+ end
39
+ expect(status).to eq 'passed'
40
+ end
41
+
42
+ it "should allow us to perform the created singleton perform_now method" do
43
+ begin
44
+ User.this_is_a_singleton_method_job_now
45
+ status = 'passed'
46
+ rescue
47
+ status = 'failed'
48
+ end
49
+ expect(status).to eq 'passed'
50
+ end
51
+
52
+ it "should allow us to perform the created instance perform_now method" do
53
+ begin
54
+ user.this_is_an_instance_method_job_now
55
+ status = 'passed'
56
+ rescue
57
+ status = 'failed'
58
+ end
59
+ expect(status).to eq 'passed'
60
+ end
61
+
62
+ it "should accept positional arguments" do
63
+ return_value = User.this_is_a_singleton_method_job_now("positional_argument")
64
+ expect(return_value).to eq "positional_argument"
65
+ end
66
+
67
+ it "should accept keyword arguments " do
68
+ return_value = User.this_is_a_singleton_method_job_now(keyword_value: "keyword_argument")
69
+ expect(return_value).to eq "keyword_argument"
70
+ end
71
+
72
+ end
@@ -0,0 +1,16 @@
1
+
2
+ # NOT YET IMPLEMENTED, SINCE THIS PART OF EITIL IS NOT YET IN USE.
3
+ # FIRST HOOK UP INTO EITJE_API, SINCE THAT MAY CHANGE THE FUNCTIONALITY.
4
+
5
+ # RSpec.describe "EitilWrapper::Routes" do
6
+
7
+ # before do
8
+ # @pretty_routes = `cd spec/dummy_app && rails routes`
9
+ # @routes = @pretty_routes.gsub(/[ \t]+/, ' ')
10
+ # end
11
+
12
+ # it "should " do
13
+ # expect(@routes).to include('POST /users(.:format) users#create')
14
+ # end
15
+
16
+ # end
@@ -0,0 +1,154 @@
1
+
2
+ RSpec.describe "EitilWrapper::Scopes" do
3
+
4
+ let(:scopes) { User.singleton_methods(false) }
5
+
6
+ context "for columns of datatype: boolean" do
7
+
8
+ it "should create the scope .{column_name}_true" do
9
+ expect(scopes).to include(:confirmed_true)
10
+ end
11
+
12
+ it "should create the scope .{column_name}_false" do
13
+ expect(scopes).to include(:confirmed_false)
14
+ end
15
+
16
+ end
17
+
18
+ context "for columns of datatype: date" do
19
+
20
+ it "should create the scope .{column_name}_today" do
21
+ expect(scopes).to include(:birthday_today)
22
+ end
23
+
24
+ it "should create the scope .{column_name}_past" do
25
+ expect(scopes).to include(:birthday_past)
26
+ end
27
+
28
+ it "should create the scope .{column_name}_future" do
29
+ expect(scopes).to include(:birthday_future)
30
+ end
31
+
32
+ it "should create the scope .{column_name}_on_date(date)" do
33
+ expect(scopes).to include(:birthday_on_date)
34
+ end
35
+
36
+ it "should create the scope .{column_name}_before_date(date)" do
37
+ expect(scopes).to include(:birthday_before_date)
38
+ end
39
+
40
+ it "should create the scope .{column_name}_after_date(date)" do
41
+ expect(scopes).to include(:birthday_after_date)
42
+ end
43
+
44
+ it "should create the scope .{column_name}_between_dates(start_date, end_date)" do
45
+ expect(scopes).to include(:birthday_between_dates)
46
+ end
47
+
48
+ it "should create the scope .{column_name}_oldest_first" do
49
+ expect(scopes).to include(:birthday_oldest_first)
50
+ end
51
+
52
+ it "should create the scope .{column_name}_newest_first" do
53
+ expect(scopes).to include(:birthday_newest_first)
54
+ end
55
+
56
+ end
57
+
58
+ context "for columns of datatype: datetime" do
59
+
60
+ it "should create the scope .{column_name}_today" do
61
+ expect(scopes).to include(:last_sign_in_today)
62
+ end
63
+
64
+ it "should create the scope .{column_name}_past" do
65
+ expect(scopes).to include(:last_sign_in_past)
66
+ end
67
+
68
+ it "should create the scope .{column_name}_future" do
69
+ expect(scopes).to include(:last_sign_in_future)
70
+ end
71
+
72
+ it "should create the scope .{column_name}_on_date(date)" do
73
+ expect(scopes).to include(:last_sign_in_on_date)
74
+ end
75
+
76
+ it "should create the scope .{column_name}_before_date(date)" do
77
+ expect(scopes).to include(:last_sign_in_before_date)
78
+ end
79
+
80
+ it "should create the scope .{column_name}_after_date(date)" do
81
+ expect(scopes).to include(:last_sign_in_after_date)
82
+ end
83
+
84
+ it "should create the scope .{column_name}_between_dates(start_date, end_date)" do
85
+ expect(scopes).to include(:last_sign_in_between_dates)
86
+ end
87
+
88
+ it "should create the scope .{column_name}_oldest_first" do
89
+ expect(scopes).to include(:last_sign_in_oldest_first)
90
+ end
91
+
92
+ it "should create the scope .{column_name}_newest_first" do
93
+ expect(scopes).to include(:last_sign_in_newest_first)
94
+ end
95
+
96
+ end
97
+
98
+ context "for columns of datatype: integer" do
99
+
100
+ it "should create the scope .{column_name}_equal_to(number)" do
101
+ expect(scopes).to include(:age_equal_to)
102
+ end
103
+
104
+ it "should create the scope .{column_name}_lower_than(number)" do
105
+ expect(scopes).to include(:age_lower_than)
106
+ end
107
+
108
+ it "should create the scope .{column_name}_higher_than(number)" do
109
+ expect(scopes).to include(:age_higher_than)
110
+ end
111
+
112
+ it "should create the scope .{column_name}_between(min, max)" do
113
+ expect(scopes).to include(:age_between)
114
+ end
115
+
116
+ it "should create the scope .{column_name}_ascending" do
117
+ expect(scopes).to include(:age_ascending)
118
+ end
119
+
120
+ it "should create the scope .{column_name}_descending" do
121
+ expect(scopes).to include(:age_descending)
122
+ end
123
+
124
+ end
125
+
126
+ context "for columns of datatype: float" do
127
+
128
+ it "should create the scope .{column_name}_equal_to(number)" do
129
+ expect(scopes).to include(:wage_equal_to)
130
+ end
131
+
132
+ it "should create the scope .{column_name}_lower_than(number)" do
133
+ expect(scopes).to include(:wage_lower_than)
134
+ end
135
+
136
+ it "should create the scope .{column_name}_higher_than(number)" do
137
+ expect(scopes).to include(:wage_higher_than)
138
+ end
139
+
140
+ it "should create the scope .{column_name}_between(min, max)" do
141
+ expect(scopes).to include(:wage_between)
142
+ end
143
+
144
+ it "should create the scope .{column_name}_ascending" do
145
+ expect(scopes).to include(:wage_ascending)
146
+ end
147
+
148
+ it "should create the scope .{column_name}_descending" do
149
+ expect(scopes).to include(:wage_descending)
150
+ end
151
+
152
+ end
153
+
154
+ end