decidim-dev 0.31.8 → 0.32.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -12
  3. data/app/commands/decidim/dev/create_dummy_resource.rb +6 -6
  4. data/app/controllers/decidim/dev/dummy_resources_controller.rb +0 -2
  5. data/app/models/decidim/dev/dummy_resource.rb +4 -1
  6. data/app/models/decidim/dev/nested_dummy_resource.rb +1 -0
  7. data/app/packs/src/decidim/dev/accessibility.js +1 -1
  8. data/config/locales/ar.yml +1 -2
  9. data/config/locales/bg.yml +1 -2
  10. data/config/locales/ca-IT.yml +1 -2
  11. data/config/locales/ca.yml +1 -2
  12. data/config/locales/cs.yml +1 -2
  13. data/config/locales/de.yml +1 -2
  14. data/config/locales/el.yml +1 -2
  15. data/config/locales/es-MX.yml +1 -2
  16. data/config/locales/es-PY.yml +1 -2
  17. data/config/locales/es.yml +1 -2
  18. data/config/locales/eu.yml +7 -8
  19. data/config/locales/fi-plain.yml +1 -2
  20. data/config/locales/fi.yml +1 -2
  21. data/config/locales/fr-CA.yml +1 -2
  22. data/config/locales/fr.yml +1 -2
  23. data/config/locales/ga-IE.yml +0 -1
  24. data/config/locales/gl.yml +2 -17
  25. data/config/locales/hu.yml +1 -2
  26. data/config/locales/id-ID.yml +1 -2
  27. data/config/locales/is-IS.yml +1 -2
  28. data/config/locales/it.yml +1 -2
  29. data/config/locales/ja.yml +1 -2
  30. data/config/locales/lt.yml +1 -2
  31. data/config/locales/lv.yml +1 -2
  32. data/config/locales/nl.yml +1 -2
  33. data/config/locales/no.yml +1 -2
  34. data/config/locales/pl.yml +1 -2
  35. data/config/locales/pt-BR.yml +1 -2
  36. data/config/locales/pt.yml +1 -2
  37. data/config/locales/ro-RO.yml +1 -2
  38. data/config/locales/ru.yml +1 -2
  39. data/config/locales/sk.yml +1 -26
  40. data/config/locales/sl.yml +0 -1
  41. data/config/locales/sv.yml +1 -2
  42. data/config/locales/tr-TR.yml +1 -2
  43. data/config/locales/uk.yml +0 -1
  44. data/config/locales/zh-CN.yml +1 -2
  45. data/config/locales/zh-TW.yml +1 -2
  46. data/config/rubocop/decidim-linters/configuration.yml +4 -36
  47. data/config/rubocop/rails/disabled.yml +6 -0
  48. data/config/rubocop/rspec/configuration.yml +5 -1
  49. data/config/rubocop/ruby/configuration.yml +2 -3
  50. data/config/rubocop/ruby/disabled.yml +9 -0
  51. data/config/rubocop/yard/configuration.yml +1 -0
  52. data/decidim-dev.gemspec +21 -23
  53. data/lib/decidim/dev/assets/assemblies.json +1 -21
  54. data/lib/decidim/dev/assets/assemblies_with_null.json +1 -2
  55. data/lib/decidim/dev/assets/participatory_processes.json +1 -4
  56. data/lib/decidim/dev/assets/participatory_processes_with_null.json +1 -1
  57. data/lib/decidim/dev/dummy_translator.rb +1 -1
  58. data/lib/decidim/dev/rubocop/cop/decidim/message_antipattern.rb +76 -0
  59. data/lib/decidim/dev/test/rspec_support/active_job.rb +5 -0
  60. data/lib/decidim/dev/test/rspec_support/capybara.rb +0 -54
  61. data/lib/decidim/dev/test/rspec_support/component_context.rb +1 -1
  62. data/lib/decidim/dev/test/rspec_support/helpers.rb +10 -17
  63. data/lib/decidim/dev/test/rspec_support/tom_select.rb +7 -4
  64. data/lib/decidim/dev/version.rb +1 -1
  65. data/lib/decidim/dev.rb +1 -33
  66. data/lib/erb_lint/linters/admin_page_title_linter.rb +46 -0
  67. data/lib/erb_lint/linters/partial_path_linter.rb +101 -0
  68. data/rubocop-decidim.yml +1 -0
  69. metadata +133 -131
  70. data/lib/decidim/dev/assets/8001x4000.png +0 -0
  71. data/lib/decidim/dev/assets/empty_file.png +0 -0
  72. data/lib/decidim/dev/assets/malformed_svg_unclosed_element.svg +0 -7
  73. data/lib/decidim/dev/assets/malicious_svg_animation.svg +0 -1
  74. data/lib/decidim/dev/assets/malicious_svg_animation_attribute_names.svg +0 -1
  75. data/lib/decidim/dev/assets/malicious_svg_animation_fill.svg +0 -1
  76. data/lib/decidim/dev/assets/malicious_svg_animation_style.svg +0 -1
  77. data/lib/decidim/dev/assets/malicious_svg_animation_values.svg +0 -1
  78. data/lib/decidim/dev/assets/malicious_svg_attributename_case.svg +0 -1
  79. data/lib/decidim/dev/assets/malicious_svg_backslash_reference.svg +0 -1
  80. data/lib/decidim/dev/assets/malicious_svg_css_backslash_url.svg +0 -1
  81. data/lib/decidim/dev/assets/malicious_svg_css_comment_in_url.svg +0 -1
  82. data/lib/decidim/dev/assets/malicious_svg_css_image_set.svg +0 -1
  83. data/lib/decidim/dev/assets/malicious_svg_css_image_set_nested_parentheses.svg +0 -1
  84. data/lib/decidim/dev/assets/malicious_svg_cursor.svg +0 -1
  85. data/lib/decidim/dev/assets/malicious_svg_cursor_attribute.svg +0 -1
  86. data/lib/decidim/dev/assets/malicious_svg_data_uri_declared_encoding.svg +0 -1
  87. data/lib/decidim/dev/assets/malicious_svg_data_uri_deep_nested.svg +0 -1
  88. data/lib/decidim/dev/assets/malicious_svg_data_uri_leading_space.svg +0 -1
  89. data/lib/decidim/dev/assets/malicious_svg_data_uri_nested.svg +0 -1
  90. data/lib/decidim/dev/assets/malicious_svg_data_uri_parameter.svg +0 -1
  91. data/lib/decidim/dev/assets/malicious_svg_entity.svg +0 -5
  92. data/lib/decidim/dev/assets/malicious_svg_entity_parameter.svg +0 -7
  93. data/lib/decidim/dev/assets/malicious_svg_external_animation.svg +0 -1
  94. data/lib/decidim/dev/assets/malicious_svg_external_animation_missing_target.svg +0 -1
  95. data/lib/decidim/dev/assets/malicious_svg_external_animation_target.svg +0 -1
  96. data/lib/decidim/dev/assets/malicious_svg_external_feimage.svg +0 -1
  97. data/lib/decidim/dev/assets/malicious_svg_external_image.svg +0 -1
  98. data/lib/decidim/dev/assets/malicious_svg_external_use.svg +0 -1
  99. data/lib/decidim/dev/assets/malicious_svg_fill_external_reference.svg +0 -1
  100. data/lib/decidim/dev/assets/malicious_svg_foreign_object.svg +0 -1
  101. data/lib/decidim/dev/assets/malicious_svg_handler.svg +0 -1
  102. data/lib/decidim/dev/assets/malicious_svg_marker_external_reference.svg +0 -1
  103. data/lib/decidim/dev/assets/malicious_svg_mask_attribute.svg +0 -1
  104. data/lib/decidim/dev/assets/malicious_svg_script.svg +0 -1
  105. data/lib/decidim/dev/assets/malicious_svg_style_comment_string.svg +0 -1
  106. data/lib/decidim/dev/assets/malicious_svg_style_import.svg +0 -1
  107. data/lib/decidim/dev/assets/malicious_svg_style_import_string.svg +0 -1
  108. data/lib/decidim/dev/assets/malicious_svg_style_url_escape.svg +0 -1
  109. data/lib/decidim/dev/assets/malicious_svg_style_url_string.svg +0 -1
  110. data/lib/decidim/dev/assets/malicious_svg_stylesheet_pi.svg +0 -1
  111. data/lib/decidim/dev/assets/malicious_svg_uri.svg +0 -1
  112. data/lib/decidim/dev/assets/spoofed_image.png +0 -0
  113. data/lib/decidim/dev/assets/spoofed_image_binary.png +0 -1
  114. data/lib/decidim/dev/assets/spoofed_image_html.png +0 -5
  115. data/lib/decidim/dev/assets/spoofed_svg_xml.svg +0 -2
  116. data/lib/decidim/dev/assets/test.avif +0 -0
  117. data/lib/decidim/dev/assets/test.gif +0 -0
  118. data/lib/decidim/dev/assets/test.heic +0 -0
  119. data/lib/decidim/dev/assets/test.svg +0 -1
  120. data/lib/decidim/dev/assets/test_animation.svg +0 -1
  121. data/lib/decidim/dev/assets/test_animation_link.svg +0 -7
  122. data/lib/decidim/dev/assets/test_animation_presentation_reference.svg +0 -8
  123. data/lib/decidim/dev/assets/test_complex.svg +0 -12
  124. data/lib/decidim/dev/assets/test_css_references.svg +0 -14
  125. data/lib/decidim/dev/assets/test_data_uri_declared_encoding.svg +0 -5
  126. data/lib/decidim/dev/assets/test_entity_in_comment.svg +0 -8
  127. data/lib/decidim/dev/assets/test_entity_in_processing_instruction.svg +0 -7
  128. data/lib/decidim/dev/assets/test_percent_encoded_fragment.svg +0 -7
  129. data/lib/decidim/dev/assets/test_percent_encoded_multibyte_reference.svg +0 -7
  130. data/lib/decidim/dev/assets/test_percent_encoded_multibyte_reference_mixed.svg +0 -8
  131. data/lib/decidim/dev/assets/test_presentation_attribute_references.svg +0 -13
  132. data/lib/decidim/dev/assets/test_references.svg +0 -12
  133. data/lib/decidim/dev/assets/test_style_text.svg +0 -9
  134. data/lib/decidim/dev/assets/video.mp4 +0 -0
  135. data/lib/decidim/dev/rubocop/cop/decidim/enforce_permission_to.rb +0 -459
  136. data/lib/decidim/dev/rubocop/cop/decidim/organization_scoped_finder.rb +0 -200
  137. /data/lib/decidim/dev/assets/{import_participatory_space_private_users.csv → import_members.csv} +0 -0
  138. /data/lib/decidim/dev/assets/{import_participatory_space_private_users_invalid_col_sep.csv → import_members_invalid_col_sep.csv} +0 -0
  139. /data/lib/decidim/dev/assets/{import_participatory_space_private_users_iso8859-1.csv → import_members_iso8859-1.csv} +0 -0
  140. /data/lib/decidim/dev/assets/{import_participatory_space_private_users_nok.csv → import_members_nok.csv} +0 -0
  141. /data/lib/decidim/dev/assets/{import_participatory_space_private_users_with_bom.csv → import_members_with_bom.csv} +0 -0
@@ -1,13 +1,8 @@
1
- ---
2
1
  sk:
3
2
  activemodel:
4
3
  attributes:
5
- dummy:
6
- image: Obrázok
7
- dummy_attribute: Fiktívny atribút
8
4
  dummy_resource:
9
5
  created_at: Vytvorené
10
- decidim_scope_id: Oblasť
11
6
  field: Moje pole
12
7
  start_date: Dátum začatia
13
8
  title: Názov
@@ -18,31 +13,12 @@ sk:
18
13
  dummy:
19
14
  settings:
20
15
  global:
21
- clear_all: Vymazať všetko
22
- guided: Riadený vstup
23
- guided_help: Text pomocníka
24
- guided_readonly: Zakázaný vstup
25
- guided_rich: Riadený formátovaný vstup
26
- guided_rich_help_html: HTML <strong>text</strong> pomocníka
27
- guided_rich_readonly_html: HTML <strong>text</strong> pomocníka pre zakázaný vstup
28
- readonly_attribute: Atribút iba na čítanie
29
- test: Test
30
- test_add: Pridať test
31
- test_choices:
32
- a: Možnosť A
33
- b: Možnosť B
34
- c: Možnosť C
35
16
  test_options:
36
17
  bar: Stĺpec
37
- baz: Baz
38
18
  foo: Test
39
19
  step:
40
- likes_blocked: Lajky zablokované
41
- likes_enabled: Lajky povolené
42
- readonly_step_attribute: Atribút kroku iba na čítanie
43
20
  test_options:
44
21
  bar: Stĺpec
45
- baz: Baz
46
22
  foo: Test
47
23
  dummy:
48
24
  admin:
@@ -52,13 +28,12 @@ sk:
52
28
  badges:
53
29
  test:
54
30
  conditions:
55
- - Použiť testovacie prostredie pre decidim.
31
+ - Použiť testovacie prostredie pre decidim.
56
32
  description: Účastníci dostanú tento odznak za vytváranie testov.
57
33
  description_another: Tento účastník vytvoril %{score} testov.
58
34
  description_own: Vytvorili ste %{score} testov.
59
35
  name: Testy
60
36
  next_level_in: Vytvorte o %{score} testov viac pre dosiahnutie ďalšej úrovne!
61
- unearned_another: Tento účastník zatiaľ nevytvoril žiadne testy.
62
37
  unearned_own: Zatiaľ ste nevytvorili žiadny test.
63
38
  resource_links:
64
39
  test_link:
@@ -1,4 +1,3 @@
1
- ---
2
1
  sl:
3
2
  activemodel:
4
3
  attributes:
@@ -1,4 +1,3 @@
1
- ---
2
1
  sv:
3
2
  activemodel:
4
3
  attributes:
@@ -52,7 +51,7 @@ sv:
52
51
  badges:
53
52
  test:
54
53
  conditions:
55
- - Använd en testmiljö för decidim.
54
+ - Använd en testmiljö för decidim.
56
55
  description: Deltagare får detta märke genom att skapa tester.
57
56
  description_another: Deltagaren har skapat %{score} tester.
58
57
  description_own: Du har skapat %{score} tester.
@@ -1,4 +1,3 @@
1
- ---
2
1
  tr:
3
2
  activemodel:
4
3
  attributes:
@@ -37,7 +36,7 @@ tr:
37
36
  badges:
38
37
  test:
39
38
  conditions:
40
- - Decidim için bir test ortamı kullanın.
39
+ - Decidim için bir test ortamı kullanın.
41
40
  description: Katılımcılar testler oluşturarak bu rozeti alırlar.
42
41
  description_another: Bu katılımcı %{score} test oluşturdu.
43
42
  description_own: '%{score} test oluşturdunuz.'
@@ -1,4 +1,3 @@
1
- ---
2
1
  uk:
3
2
  activemodel:
4
3
  attributes:
@@ -1,4 +1,3 @@
1
- ---
2
1
  zh-CN:
3
2
  activemodel:
4
3
  attributes:
@@ -37,7 +36,7 @@ zh-CN:
37
36
  badges:
38
37
  test:
39
38
  conditions:
40
- - 对判定环境使用测试环境。
39
+ - 对判定环境使用测试环境。
41
40
  description: 参与者通过创建测试获得这个徽章。
42
41
  description_another: 此参与者已创建了 %{score} 个测试。
43
42
  description_own: 您已创建了 %{score} 个测试。
@@ -1,4 +1,3 @@
1
- ---
2
1
  zh-TW:
3
2
  activemodel:
4
3
  attributes:
@@ -45,7 +44,7 @@ zh-TW:
45
44
  badges:
46
45
  test:
47
46
  conditions:
48
- - 在Decidim中使用測試環境。
47
+ - 在Decidim中使用測試環境。
49
48
  description: 參與者通過建立測試可獲得此徽章。
50
49
  description_another: 此參與者已建立了 %{score} 個測試。
51
50
  description_own: 您已建立了 %{score} 個測試。
@@ -1,40 +1,8 @@
1
1
  require:
2
- - decidim/dev/rubocop/cop/decidim/organization_scoped_finder
3
- - decidim/dev/rubocop/cop/decidim/enforce_permission_to
2
+ - decidim/dev/rubocop/cop/decidim/message_antipattern
4
3
 
5
- Decidim/OrganizationScopedFinder:
4
+ Decidim/MessageAntipattern:
6
5
  Enabled: true
7
- Severity: warning
8
6
  Include:
9
- - "**/app/controllers/**/admin/**/*.rb"
10
- Exclude:
11
- - "**/decidim-system/**/*.rb"
12
-
13
- Decidim/EnforcePermissionTo:
14
- Enabled: true
15
- Severity: warning
16
- Include:
17
- - "**/app/controllers/**/*.rb"
18
- # This cop only understands action-level authorization checks
19
- # (`enforce_permission_to` / `action_authorized_to`). The paths below are
20
- # intentionally authorized through a different model, so they cannot be
21
- # covered by an action-level check:
22
- Exclude:
23
- # - decidim-api: GraphQL/API entry points authorized by
24
- # `ensure_api_authenticated!` and type-level authorization.
25
- - "decidim-api/**/*.rb"
26
- # - decidim-design: development-only styleguide app.
27
- - "decidim-design/**/*.rb"
28
- # - decidim-system: installation-wide system admin guarded by `authenticate_admin!`.
29
- - "decidim-system/**/*.rb"
30
- # - decidim-devise/doorkeeper: framework controllers where authentication
31
- # itself is the operation (Devise, OAuth).
32
- - "decidim-core/app/controllers/decidim/devise/**/*.rb"
33
- - "decidim-core/app/controllers/decidim/doorkeeper/**/*.rb"
34
- # - favicon: always visible
35
- - decidim-core/app/controllers/decidim/favicon_controller.rb
36
- # - errors: always visible
37
- - decidim-core/app/controllers/decidim/errors_controller.rb
38
- # - form_factory: builds form objects through an internal class; its methods
39
- # are not controller actions.
40
- - decidim-core/app/controllers/concerns/decidim/form_factory.rb
7
+ - "**/spec/**/*"
8
+ - "**/test/**/*"
@@ -44,3 +44,9 @@ Rails/EnumHash:
44
44
 
45
45
  Rails/I18nLazyLookup:
46
46
  Enabled: false
47
+
48
+ Rails/FindByOrAssignmentMemoization:
49
+ Enabled: false
50
+
51
+ Rails/Exit:
52
+ Enabled: false
@@ -30,7 +30,6 @@ RSpec/DescribeClass:
30
30
  - spec/version_files_spec.rb
31
31
  - spec/spellcheck_spec.rb
32
32
  - spec/i18n_spec.rb
33
- - "**/spec/rubocop/**/*"
34
33
  - "**/*/spec/**/*_badge_spec.rb"
35
34
  - "**/tasks/**/*"
36
35
 
@@ -51,3 +50,8 @@ RSpec/RepeatedExampleGroupDescription:
51
50
 
52
51
  RSpec/RepeatedExampleGroupBody:
53
52
  Enabled: true
53
+
54
+ RSpec/ExpectActual:
55
+ Enabled: true
56
+ Exclude:
57
+ - decidim-core/spec/system/homepage_spec.rb
@@ -1,5 +1,3 @@
1
- require: rubocop
2
-
3
1
  # Common configuration.
4
2
  AllCops:
5
3
  Include:
@@ -68,7 +66,7 @@ AllCops:
68
66
  # If a value is specified for TargetRubyVersion then it is used.
69
67
  # Else if .ruby-version exists and it contains an MRI version it is used.
70
68
  # Otherwise we fallback to the oldest officially supported Ruby version (2.0).
71
- TargetRubyVersion: 3.3
69
+ TargetRubyVersion: 3.4
72
70
 
73
71
  # Indent private/protected/public as deep as method definitions
74
72
  Layout/AccessModifierIndentation:
@@ -521,6 +519,7 @@ Style/GuardClause:
521
519
  MinBodyLength: 6
522
520
 
523
521
  Style/HashSyntax:
522
+ EnforcedShorthandSyntax: always
524
523
  EnforcedStyle: no_mixed_keys
525
524
  SupportedStyles:
526
525
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -104,3 +104,12 @@ Style/EmptyStringInsideInterpolation:
104
104
 
105
105
  Style/ComparableBetween:
106
106
  Enabled: false
107
+
108
+ Style/FileOpen:
109
+ Enabled: false
110
+
111
+ Style/ModuleMemberExistenceCheck:
112
+ Enabled: false
113
+
114
+ Style/OneClassPerFile:
115
+ Enabled: false
@@ -0,0 +1 @@
1
+ plugins: rubocop-yard
data/decidim-dev.gemspec CHANGED
@@ -2,12 +2,9 @@
2
2
 
3
3
  $LOAD_PATH.push File.expand_path("lib", __dir__)
4
4
 
5
- # Maintain your gem's version:
6
- require "decidim/dev/version"
7
-
8
- # Describe your gem and declare its dependencies:
9
5
  Gem::Specification.new do |s|
10
- s.version = Decidim::Dev.version
6
+ version = "0.32.0.rc1"
7
+ s.version = version
11
8
  s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
12
9
  s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
13
10
  s.license = "AGPL-3.0-or-later"
@@ -19,7 +16,7 @@ Gem::Specification.new do |s|
19
16
  "homepage_uri" => "https://decidim.org",
20
17
  "source_code_uri" => "https://github.com/decidim/decidim"
21
18
  }
22
- s.required_ruby_version = "~> 3.3.0"
19
+ s.required_ruby_version = "~> 3.4.0"
23
20
 
24
21
  s.name = "decidim-dev"
25
22
  s.summary = "Decidim dev tools"
@@ -33,42 +30,43 @@ Gem::Specification.new do |s|
33
30
  end
34
31
 
35
32
  s.add_dependency "capybara", "~> 3.39"
36
- s.add_dependency "decidim-admin", Decidim::Dev.version
37
- s.add_dependency "decidim-api", Decidim::Dev.version
38
- s.add_dependency "decidim-comments", Decidim::Dev.version
39
- s.add_dependency "decidim-core", Decidim::Dev.version
40
- s.add_dependency "decidim-generators", Decidim::Dev.version
41
- s.add_dependency "decidim-verifications", Decidim::Dev.version
33
+ s.add_dependency "decidim-admin", version
34
+ s.add_dependency "decidim-api", version
35
+ s.add_dependency "decidim-comments", version
36
+ s.add_dependency "decidim-core", version
37
+ s.add_dependency "decidim-generators", version
38
+ s.add_dependency "decidim-verifications", version
42
39
  s.add_dependency "factory_bot_rails", "~> 6.2"
43
40
  s.add_dependency "faker", "~> 3.2"
44
41
 
45
- s.add_dependency "bullet", "~> 8.0.0"
46
- s.add_dependency "byebug", "~> 11.0"
47
- s.add_dependency "erb_lint", "~> 0.8.0"
42
+ s.add_dependency "bullet", "~> 8.1.0"
43
+ s.add_dependency "byebug", ">= 11", "< 14"
44
+ s.add_dependency "erb_lint", ">= 0.8", "< 0.10"
48
45
  s.add_dependency "i18n-tasks", "~> 1.0"
49
46
  s.add_dependency "nokogiri", "~> 1.16", ">= 1.16.2"
50
- s.add_dependency "parallel_tests", "~> 4.2"
51
- s.add_dependency "puma", "~> 6.5"
47
+ s.add_dependency "parallel_tests", ">= 4.2", "< 6.0"
48
+ s.add_dependency "puma", ">= 6.5", "< 8.0"
52
49
  s.add_dependency "rails-controller-testing", "~> 1.0"
53
50
  s.add_dependency "rspec", "~> 3.12"
54
51
  s.add_dependency "rspec-cells", "~> 0.3.7"
55
52
  s.add_dependency "rspec-html-matchers", "~> 0.10"
56
53
  s.add_dependency "rspec_junit_formatter", "~> 0.6.0"
57
- s.add_dependency "rspec-rails", "~> 6.0"
54
+ s.add_dependency "rspec-rails", ">= 6", "< 9"
58
55
  s.add_dependency "rspec-retry", "~> 0.6.2"
59
- s.add_dependency "rubocop", "~> 1.78.0"
56
+ s.add_dependency "rubocop", ">= 1.78", "< 1.87"
60
57
  s.add_dependency "rubocop-capybara", "~> 2.22.0", ">= 2.22.1"
61
- s.add_dependency "rubocop-factory_bot", "~> 2.27.0"
58
+ s.add_dependency "rubocop-factory_bot", ">= 2.27", "< 2.29"
62
59
  s.add_dependency "rubocop-faker", "~> 1.3", ">= 1.3.0"
63
60
  s.add_dependency "rubocop-graphql", "~> 1.5", ">= 1.5.6"
64
61
  s.add_dependency "rubocop-performance", "~> 1.25", ">= 1.25.0"
65
- s.add_dependency "rubocop-rails", "~> 2.32.0", ">= 2.32.0"
62
+ s.add_dependency "rubocop-rails", ">= 2.32", "< 2.35"
66
63
  s.add_dependency "rubocop-rspec", "~> 3.0", ">= 3.6.0"
67
- s.add_dependency "rubocop-rspec_rails", "~> 2.31.0"
64
+ s.add_dependency "rubocop-rspec_rails", ">= 2.31", "< 2.33"
68
65
  s.add_dependency "rubocop-rubycw", "~> 0.2.0"
66
+ s.add_dependency "rubocop-yard", ">= 1.0", "< 1.2"
69
67
  s.add_dependency "selenium-webdriver", "~> 4.9"
70
68
  s.add_dependency "simplecov", "~> 0.22.0"
71
- s.add_dependency "simplecov-cobertura", "~> 2.1.0"
69
+ s.add_dependency "simplecov-cobertura", "~> 3.1.0"
72
70
  s.add_dependency "spring", "~> 4.0"
73
71
  s.add_dependency "spring-watcher-listen", "~> 2.0"
74
72
  s.add_dependency "w3c_rspec_validators", "~> 0.3.0"
@@ -47,6 +47,7 @@
47
47
  "es": "Incidunt provident doloremque."
48
48
  },
49
49
  "decidim_scope_id": null,
50
+ "access_mode": "open",
50
51
  "paticipatory_scope": {
51
52
  "ca": "Assumenda.",
52
53
  "en": "Quidem.",
@@ -58,7 +59,6 @@
58
59
  "es": "Et molestiae."
59
60
  },
60
61
  "scopes_enabled": true,
61
- "private_space": false,
62
62
  "reference": "PhD-ASSE-2020-01-1",
63
63
  "purpose_of_action": {
64
64
  "ca": "<p>Velit a qui. Debitis rem occaecati. Id minus est.</p>",
@@ -90,7 +90,6 @@
90
90
  "en": "<p>Optio ducimus velit. Facilis omnis asperiores. Corporis ipsa non.</p>",
91
91
  "es": "<p>Est dolorum et. Quo sed ut. Corporis quos sit.</p>"
92
92
  },
93
- "is_transparent": true,
94
93
  "special_features": {
95
94
  "ca": "<p>Dolor et reprehenderit. Unde soluta eum. Omnis occaecati omnis.</p>",
96
95
  "en": "<p>Et atque perspiciatis. Quas impedit corporis. Nesciunt blanditiis ipsa.</p>",
@@ -106,7 +105,6 @@
106
105
  "en": "ut",
107
106
  "es": "rerum"
108
107
  },
109
- "decidim_assemblies_type_id": 1,
110
108
  "area": {
111
109
  "id": null,
112
110
  "name": {
@@ -514,7 +512,6 @@
514
512
  "geocoding_enabled": false,
515
513
  "attachments_allowed": false,
516
514
  "resources_permissions_enabled": true,
517
- "collaborative_drafts_enabled": true,
518
515
  "participatory_texts_enabled": false,
519
516
  "amendments_enabled": false,
520
517
  "amendments_wizard_help_text": {
@@ -578,23 +575,6 @@
578
575
  "permissions": null,
579
576
  "published_at": "2020-01-22 07:55:05 UTC"
580
577
  },
581
- {
582
- "manifest_name": "sortitions",
583
- "id": 26,
584
- "name": {
585
- "ca": "Sortejos",
586
- "en": "Sortitions",
587
- "es": "Sorteos"
588
- },
589
- "participatory_space_id": 1,
590
- "participatory_space_type": "Decidim::Assembly",
591
- "settings": {
592
- "comments_enabled": true
593
- },
594
- "weight": 0,
595
- "permissions": null,
596
- "published_at": "2020-01-22 07:55:19 UTC"
597
- },
598
578
  {
599
579
  "manifest_name": "surveys",
600
580
  "id": 23,
@@ -58,7 +58,7 @@
58
58
  "es": "Et molestiae."
59
59
  },
60
60
  "scopes_enabled": true,
61
- "private_space": false,
61
+ "access_mode": "open",
62
62
  "reference": "PhD-ASSE-2020-01-1",
63
63
  "purpose_of_action": {
64
64
  "ca": "<p>Velit a qui. Debitis rem occaecati. Id minus est.</p>",
@@ -106,7 +106,6 @@
106
106
  "en": "ut",
107
107
  "es": "rerum"
108
108
  },
109
- "decidim_assemblies_type_id": 1,
110
109
  "area": {
111
110
  "id": null,
112
111
  "name": {
@@ -87,7 +87,7 @@
87
87
  "es": "South Carolina"
88
88
  }
89
89
  },
90
- "private_space": false,
90
+ "access_mode": "open",
91
91
  "promoted": true,
92
92
  "scopes_enabled": true,
93
93
  "participatory_process_steps": [
@@ -105,9 +105,6 @@
105
105
  },
106
106
  "start_date": "2019-09-02",
107
107
  "end_date": "2019-12-02",
108
- "cta_path": null,
109
- "cta_text": {
110
- },
111
108
  "active": true,
112
109
  "position": 0
113
110
  }
@@ -87,7 +87,7 @@
87
87
  "es": "South Carolina"
88
88
  }
89
89
  },
90
- "private_space": false,
90
+ "access_mode": "open",
91
91
  "promoted": true,
92
92
  "scopes_enabled": true,
93
93
  "participatory_process_steps": null,
@@ -20,7 +20,7 @@ module Decidim
20
20
  def translate
21
21
  translated_text = "#{target_locale} - #{text}"
22
22
 
23
- MachineTranslationSaveJob.perform_later(
23
+ Decidim::MachineTranslationSaveJob.perform_later(
24
24
  resource,
25
25
  field_name,
26
26
  target_locale,
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop"
4
+
5
+ module RuboCop
6
+ module Cop
7
+ module Decidim
8
+ class MessageAntipattern < RuboCop::Cop::Base
9
+ SINGLE_WORD_ANTI_PATTERNS = %w(
10
+ successfully
11
+ problem
12
+ error
13
+ warning
14
+ done
15
+ complete
16
+ finished
17
+ ok
18
+ okay
19
+ saved
20
+ updated
21
+ created
22
+ deleted
23
+ removed
24
+ published
25
+ unpublished
26
+ ).freeze
27
+
28
+ MSG = "Anti-pattern detected: avoid generic single-word text in have_callout/have_admin_callout/have_content. " \
29
+ "Use the full admin flash message, e.g. 'Meeting successfully published'. " \
30
+ "Exception: when used inside `within` blocks (e.g., for checking `.label` elements)."
31
+
32
+ def on_send(node)
33
+ return unless [:have_callout, :have_admin_callout, :have_content].include?(node.method_name)
34
+ return if within_block?(node)
35
+
36
+ first_argument = node.first_argument
37
+ return unless first_argument
38
+
39
+ if first_argument.nil_type?
40
+ add_offense(first_argument, message: MSG)
41
+ return
42
+ end
43
+ return unless first_argument.str_type?
44
+
45
+ text = first_argument.value
46
+ return unless antipattern_text?(text)
47
+
48
+ add_offense(first_argument, message: MSG)
49
+ end
50
+
51
+ private
52
+
53
+ def within_block?(node)
54
+ node.each_ancestor(:block).any? do |ancestor|
55
+ ancestor.send_node&.method_name == :within
56
+ end
57
+ end
58
+
59
+ def antipattern_text?(text)
60
+ return true if text.nil?
61
+ return true if text.empty?
62
+
63
+ stripped_text = text.gsub(/[[:punct:]\s]/, "")
64
+ return true if stripped_text.empty?
65
+
66
+ single_word = text.strip !~ /\s/
67
+ return false unless single_word
68
+
69
+ return true if SINGLE_WORD_ANTI_PATTERNS.include?(stripped_text.downcase)
70
+
71
+ false
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -14,6 +14,11 @@ end
14
14
  RSpec.configure do |config|
15
15
  config.include ActiveJob::TestHelper
16
16
  config.include DecidimActiveJobExtensions
17
+
18
+ config.before do
19
+ clear_enqueued_jobs
20
+ clear_performed_jobs
21
+ end
17
22
  end
18
23
 
19
24
  ActiveJob::Base.queue_adapter = :test
@@ -27,60 +27,6 @@ module Decidim
27
27
 
28
28
  "http"
29
29
  end
30
-
31
- def expire_browser_session(wait: Capybara.default_max_wait_time)
32
- wait_pending_requests(wait)
33
-
34
- travel(Decidim.config.expire_session_after + 1.second) do
35
- yield
36
- end
37
- end
38
-
39
- # Clear the buffers and background connections by taking the browser to
40
- # offline state for a tiny moment. If a block is given, any further commands
41
- # can be run during the offline state.
42
- def force_browser_offline_state
43
- page.driver.browser.execute_cdp(
44
- "Network.emulateNetworkConditions",
45
- offline: true,
46
- latency: 0,
47
- downloadThroughput: 0,
48
- uploadThroughput: 0
49
- )
50
- sleep 0.05
51
-
52
- yield if block_given?
53
- ensure
54
- page.driver.browser.execute_cdp(
55
- "Network.emulateNetworkConditions",
56
- offline: false,
57
- latency: 0,
58
- downloadThroughput: -1,
59
- uploadThroughput: -1
60
- )
61
- end
62
-
63
- # Waits for any pending requests to finish and clears any active browser
64
- # background connections after that.
65
- def wait_pending_requests(max_wait_time = Capybara.default_max_wait_time, idle_time: 1)
66
- wait_time = 0
67
- loop do
68
- time_since_last_asset = page.evaluate_script(
69
- <<~JS
70
- performance.now() - Math.max(...window.performance.getEntriesByType("resource").map((r) => r.responseEnd), 0)
71
- JS
72
- )
73
- break if time_since_last_asset > (idle_time * 1000)
74
-
75
- remaining_wait_time = max_wait_time - wait_time
76
- raise StandardError, "Requests still pending." if remaining_wait_time <= 0
77
-
78
- sleep_time = [idle_time, remaining_wait_time].min
79
- sleep sleep_time
80
- wait_time += sleep_time
81
- end
82
- force_browser_offline_state
83
- end
84
30
  end
85
31
  end
86
32
 
@@ -58,7 +58,7 @@ shared_context "with a component" do
58
58
  end
59
59
 
60
60
  def visit_component
61
- page.visit main_component_path(component)
61
+ page.visit main_component_path(component, locale: I18n.locale)
62
62
  end
63
63
  end
64
64
 
@@ -33,8 +33,8 @@ module Decidim
33
33
  end
34
34
 
35
35
  def within_language_menu(options = {})
36
- within(options[:admin] ? ".language-choose" : "footer") do
37
- find(options[:admin] ? "#admin-menu-trigger" : "#trigger-dropdown-language-chooser").click
36
+ within(options[:admin] ? ".language-choose" : "header") do
37
+ find(options[:admin] ? "#admin-menu-trigger" : "#trigger-dropdown-menu-language-chooser-desktop").click
38
38
  yield
39
39
  end
40
40
  end
@@ -53,12 +53,18 @@ module Decidim
53
53
  expect(page).to have_css(".main-bar #trigger-dropdown-account")
54
54
  end
55
55
 
56
- def have_admin_callout(text)
56
+ def have_callout(text)
57
57
  within_flash_messages do
58
58
  have_content text
59
59
  end
60
60
  end
61
61
 
62
+ # Fallback for legacy usage of this helper
63
+ # It actually works the same, as the markup is the same too
64
+ def have_admin_callout(text)
65
+ have_callout(text)
66
+ end
67
+
62
68
  def stub_get_request_with_format(rq_url, rs_format)
63
69
  stub_request(:get, rq_url)
64
70
  .with(
@@ -68,20 +74,7 @@ module Decidim
68
74
  "User-Agent" => "Ruby"
69
75
  }
70
76
  )
71
- .to_return(status: 200, body: stubbed_file_body(rs_format), headers: { content_type: rs_format })
72
- end
73
-
74
- # Real content for the stubbed formats. Content validation rejects empty
75
- # uploads declared as images, so the stubbed downloads must return bytes
76
- # matching their content type.
77
- def stubbed_file_body(rs_format)
78
- asset = {
79
- "image/jpeg" => "city.jpeg",
80
- "application/pdf" => "Exampledocument.pdf"
81
- }[rs_format]
82
- return "" if asset.nil?
83
-
84
- File.binread(Decidim::Dev.asset(asset))
77
+ .to_return(status: 200, body: "", headers: { content_type: rs_format })
85
78
  end
86
79
  end
87
80